Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

find-key

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Issues
File Explorer

Advanced tools

find-key

find value inside nested object from key name

    2.1.3latest
    GitHub

Version published
Maintainers
1
Weekly downloads
665
decreased by-6.47%

Weekly downloads

Readme

Source

#find-key

Finds matching value of supplied key inside deep nested object

Current Version dependency Status devDependency Status Build Status Windows Build Status Coveralls

Install

npm install find-key

Usage

find(object, key)
  • object to find the key inside
  • key is the string being searched for

The return value will be an array of values matching the key name supplied

Example

const Find = require('find-key'); const obj = { type: 'object', properties: { first: {type: 'string', format: 'lookup'}, extra: {type: 'string', format: 'lookup'}, test: {type: 'string', format: 'dbRef'}, }, additionaProperties: false, format: 'dbRef', title: 'country schema', }; const res = Find(obj, 'format'); console.log(res); // should equal an array with the following values ['lookup', 'dbRef']

FAQs

Last updated on 24 Oct 2018

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc