https://github.com/arshadkazmi42/hasattr
:mag_right: Search key, in a deep json object or array
https://github.com/arshadkazmi42/hasattr
has hasattr hasattribute haskey json jsoncontains jsonhas search
Last synced: about 1 year ago
JSON representation
:mag_right: Search key, in a deep json object or array
- Host: GitHub
- URL: https://github.com/arshadkazmi42/hasattr
- Owner: arshadkazmi42
- License: mit
- Created: 2019-01-13T07:15:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-17T15:30:33.000Z (almost 4 years ago)
- Last Synced: 2024-10-07T06:41:44.493Z (over 1 year ago)
- Topics: has, hasattr, hasattribute, haskey, json, jsoncontains, jsonhas, search
- Language: JavaScript
- Homepage:
- Size: 135 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# hasattr :mag_right:
[](https://github.com/arshadkazmi42/hasattr/actions/workflows/nodejs.yml)
[](https://www.npmjs.com/package/ak-hasattr)
[](https://www.npmjs.com/package/ak-hasattr)
[](https://www.npmjs.com/package/ak-hasattr)
[](https://github.com/arshadkazmi42/hasattr/graphs/contributors)
[](https://github.com/arshadkazmi42/hasattr/commits/master)
Search key, in a deep json object or array
## Installation
#### Using npm
```
npm install ak-hasattr
```
#### Using yarn
```
yarn add ak-hasattr
```
## Usage
```javascript
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](https://github.com/arshadkazmi42/hasattr/issues/new), fixing [open issues](https://github.com/arshadkazmi42/hasattr/issues) or by implementing a new feature. Read our contibution guide [here](CONTRIBUTING.md)