1.1.0 • Published 6 years ago

all-props v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

All Props

Utils for all props matching @paths

Installation

$ npm install all-props

Usage

const allProps = require('all-props');

const object = {
  decoyAry: [
    {
      innerAry: [
        {
          bat: 'man'
        }
      ]
    }
  ],
  outterAry: [
    {
      decoyAry: [
        {
          spider: 'man'
        }
      ],
      innerAry: [
        {
          foo: 'bar'
        },
        {
          foo: 'baz'
        }
      ]
    },
    {
      innerAry: [
        {
          hello: 'world'
        },
        {
          hello: 'computer'
        }
      ]
    }
  ]
};

const props = get(object, ['outterAry', /.*/, 'innerAry', /.*/]);

expect(props).toEqual([{foo: 'bar'}, {foo: 'baz'}, {hello: 'world'}, {hello: 'computer'}]); // true