npm

Share private packages across your team with npm Orgs, now with simplified billing via the aws marketplace!Learn more »

ak-hasattr

1.0.3 • Public • Published

hasattr 🔎

Build Status NPM Downloads Package Size NPM Version Contributors Commit

Search key, in a deep json object or array

Buy Me A Coffee Become a Patron!

Please consider donating, if you like my work

Installation

Using npm

npm install ak-hasattr

Using yarn

yarn add ak-hasattr

Usage

const hasAttr = require('ak-hasattr');
const JSON = {
  'name': 'Arshad Kazmi',
  'profile': {
    'github': {
      'username': 'arshadkazmi42',
      'repos': [
        {
          'repo_name': 'hasattr',
          'url': 'https://github.com/arshadkazmi42/hasattr',
        },
      ],
    },
    'twitter': {
      'username': 'arshadkazmi42',
    },
  },
};
 
console.log(hasAttr('name', JSON));
// true
 
console.log(hasAttr('repo_name', JSON));
// true
 
console.log(hasAttr('something', JSON));
// false
 

Contributing

We are constantly working on improving hasattr and we need all the help we can get.

You can contribute to this project by giving suggestions, fixing open issues or by implementing a new feature. Read our contibution guide here

Contributors

Thank you to all the contributors who help in making this project better 🙌

install

npm i ak-hasattr

Downloadsweekly downloads

4

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability