Skip to content

simon-p-r/find-key

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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']

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published