https://github.com/jonschlinkert/has-own-deep
Returns true if an object has an own, enumerable property. Nested properties can be checked using using dot notation paths ('a.b.c').
https://github.com/jonschlinkert/has-own-deep
dot-notation dotprop has hasownproperty javascript key node nodejs object property
Last synced: about 1 year ago
JSON representation
Returns true if an object has an own, enumerable property. Nested properties can be checked using using dot notation paths ('a.b.c').
- Host: GitHub
- URL: https://github.com/jonschlinkert/has-own-deep
- Owner: jonschlinkert
- License: mit
- Created: 2015-04-02T09:29:36.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-01-27T09:33:24.000Z (over 8 years ago)
- Last Synced: 2025-05-08T05:59:36.932Z (about 1 year ago)
- Topics: dot-notation, dotprop, has, hasownproperty, javascript, key, node, nodejs, object, property
- Language: JavaScript
- Size: 12.7 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# has-own-deep [](https://www.npmjs.com/package/has-own-deep) [](https://npmjs.org/package/has-own-deep) [](https://npmjs.org/package/has-own-deep) [](https://travis-ci.org/jonschlinkert/has-own-deep)
> Returns true if an object has an own, nested property using dot notation paths ('a.b.c').
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save has-own-deep
```
## Usage
```js
const hasOwnDeep = require('has-own-deep');
const obj = { a: { b: { c: 'd' } } };
console.log(hasOwnDeep(obj, 'a')); //=> true
console.log(hasOwnDeep(obj, 'a.b')); //=> true
console.log(hasOwnDeep(obj, 'a.b.c')); //=> true
console.log(hasOwnDeep(obj, 'c')); //=> false
console.log(hasOwnDeep(obj, 'a.c')); //=> false
console.log(hasOwnDeep(obj, 'a.b.d')); //=> false
```
## Keys with dots
Should correctly detect deeply nested keys that have dots in them.
```js
console.log(hasOwnDeep({ 'a.b.c': 'd' }, 'a.b.c')); //=> true
console.log(hasOwnDeep({ 'a.b': { c: 'd' } }, 'a.b.c')); //=> true
console.log(hasOwnDeep({ a: { 'b.c': 'd' } }, 'a.b.c')); //=> true
```
## About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Author
**Jon Schlinkert**
* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on January 26, 2018._