all-props

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i all-props

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

272 kB

Total Files

19

Last publish

Collaborators

  • zacharyrsmith