Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

obj-search

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obj-search

Get a property from an object using dot path or Regexp

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source
🔎 obj-search

Standard Travis build Standard Readme GitHub version Greenkeeper

Built with ❤︎ by Tiaan du Plessis

Table of Contents

Table of Contents
  • Introduction
  • Install
  • Usage
  • OSS
  • Contribute
  • License
  • Introduction

    Get a property from an object using dot path or Regexp.

    Install

    Install with npm

    $ npm install --save obj-search
    

    Install with yarn

    $ yarn add obj-search
    

    Usage

    To use, require/import the module and call the function in the format:

    objSearch(objectToSearch, patternToLookFor, optionalDefaultValue)
    

    An example of usage:

    
    const objSearch = require('./index')
    const nestedObject = {
      foo: {
        bar: {
          baz: 'Hai',
          foo: 'Hi'
        }
      },
      foos: [
        1,
        2,
        3
      ]
    }
    
    console.log(objSearch(nestedObject, 'foo.bar')) // { baz: 'Hai', foo: 'Hi' }
    console.log(objSearch(nestedObject, 'foo.bar.baz')) // 'Hai'
    console.log(objSearch(nestedObject, /foo/)) // [ { bar: { baz: 'Hai', foo: 'Hi' } }, 'Hi', [ 1, 2, 3 ] ]
    
    

    OSS

    pomd is made possible through Open Source Software. A very special thanks to all the modules pomd uses.

    Contributing

    All Contributions are welcome! Please open up an issue if you would like to help out. :smile:

    License

    Licensed under the MIT License.

    FAQs

    Package last updated on 25 Jan 2017

    Did you know?

    Socket

    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