Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Get a property from an object using dot path or Regexp

License

NotificationsYou must be signed in to change notification settings

trashify/obj-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

StandardTravis buildStandard ReadmeGitHub versionLicensePRsDonate

Built with ❤︎ byTiaan du Plessis

Table of Contents

Table of Contents
  • Install
  • Usage
  • OSS
  • Contribute
  • License
  • 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:

    constobjSearch=require('obj-search')constnestedObject={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

    obj-search is made possible through Open Source Software. A very special thanks to all themodules used.

    Contributing

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

    License

    Licensed under theMIT License.

    About

    Get a property from an object using dot path or Regexp

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Packages

    No packages published

    [8]ページ先頭

    ©2009-2025 Movatter.jp