‚̧Nonchalantly Performs Magic
    Have ideas to improve npm?Join in the discussion! ¬Ľ

    peekdepth

    2.0.1¬†‚Äʬ†Public¬†‚Äʬ†Published

    peekdepth

    build status codecov Code Climate

    Get the max depth of a multi-dimensional array

    Usage

    const peekdepth = require('peekdepth');
     
    let parentArray = ["parent"];
    let childArray = ["child", parentArray];
    let grandchildArray = ["grandchild", childArray, parentArray]
     
    childArray.push(grandchildArray); 
    parentArray.push(childArray);
     
    console.log('grandchildArray:', grandchildArray);
    console.log('depth:', peekdepth(grandchildArray));

    Output:

    grandchildArray: [ 'grandchild',
      [ 'child', [ 'parent', [Circular] ], [Circular] ],
      [ 'parent', [ 'child', [Circular], [Circular] ] ] ]
    depth: 3

    Install

    npm i peekdepth

    DownloadsWeekly Downloads

    1

    Version

    2.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar