Skip to content

A small utility for finding the depth of arrays, key-value objects, etc. and for deep/nested object comparison

License

Notifications You must be signed in to change notification settings

rickgladwin/depth_finder

Repository files navigation

Depth Finder

A simple utility to calculate the depth of arrays, key-value objects, etc. and for deep/nested object comparison.

coverage: 100% version: 1.0.1

Definitions

Array Depth

The highest level of nesting found in the array

Object Depth

The highest level of nesting found in the object

Other Depths

Strings, numbers, etc. are defined as zero.

Installation

  • fork this repo
  • npm install

Tests

Setup

npm install -g jest

(if you don't have jest installed globally, you may need to run this)

Default

npm run test

Verbose with Coverage Report

npm run test -- --verbose --coverage

An interactive coverage report should be generated at <repo root>/coverage/lcov-report/index.html

If you don't have lcov installed, you can install it on Mac:

brew install lcov

or Ubuntu/Linux:

sudo apt update
sudo apt install lcov

Notes:

  • The depth_finder_mongoose module has mongoose as a dependency, in order to handle Mongoose/mongodb data types. The depth_finder module will work without the mongoose dependency.
  • There is no plan to maintain this repo at this time. If you find it useful, great :)

About

A small utility for finding the depth of arrays, key-value objects, etc. and for deep/nested object comparison

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published