Socket
Socket
Sign inDemoInstall

find-key

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    find-key

find value inside nested object from key name


Version published
Weekly downloads
632
decreased by-10.48%
Maintainers
1
Install size
6.40 kB
Created
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 for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • 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