All Projects β†’ jonschlinkert β†’ glob-object

jonschlinkert / glob-object

Licence: MIT License
Filter an object using glob patterns and dot notation.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to glob-object

has-value
Returns true if a value exists, false if empty. Works with deeply nested values using object paths.
Stars: ✭ 27 (+8%)
Mutual labels:  object, property, value, dot-notation
get
🚚 A really small and type-safe (requires TypeScript >= 4.1.3) function, that gets a nested value from an object using a path string (like "a.b[0].d"). If value is 'undefined' or unreachable returns the placeholder instead.
Stars: ✭ 13 (-48%)
Mutual labels:  object, nested, dot-notation
obj-filter
JavaScript Object Filter. Deep filtering key/content recursively. Support wildcard, nested, and filter function in template.
Stars: ✭ 13 (-48%)
Mutual labels:  object, wildcard, nested
Micromatch
Contributing Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Stars: ✭ 1,979 (+7816%)
Mutual labels:  glob, wildcard
matched
Glob matching with support for multiple patterns and negation. Use `~` in cwd to find files in user home, or `@` for global npm modules.
Stars: ✭ 25 (+0%)
Mutual labels:  glob, wildcard
stringify-keys
Build an array of key paths from an object.
Stars: ✭ 18 (-28%)
Mutual labels:  object, dot-notation
dots
Implements the wildcard file matching in Go used by golint, go test etc.
Stars: ✭ 26 (+4%)
Mutual labels:  glob, wildcard
expand-hash
Recursively expands property keys with dot-notation into objects.
Stars: ✭ 25 (+0%)
Mutual labels:  object, dot-notation
object.omit
Return a copy of an object without the given keys.
Stars: ✭ 79 (+216%)
Mutual labels:  object, property
regXwild
⏱ Superfast ^Advanced wildcards++? | Unique algorithms that was implemented on native unmanaged C++ but easily accessible in .NET via Conari (with caching of 0x29 opcodes +optimizations) etc.
Stars: ✭ 20 (-20%)
Mutual labels:  glob, wildcard
globrex
Glob to regular expression with support for extended globs.
Stars: ✭ 52 (+108%)
Mutual labels:  glob, wildcard
define-property
Define a non-enumerable property on an object.
Stars: ✭ 21 (-16%)
Mutual labels:  object, property
laravel-nova-nested-form
This package allows you to include your nested relationships' forms into a parent form.
Stars: ✭ 225 (+800%)
Mutual labels:  nested
auto-request-review
A GitHub Action that automatically requests review of a pull request based on files changes and/or groups the author belongs to πŸ€–
Stars: ✭ 52 (+108%)
Mutual labels:  glob
object-keys
Object.keys shim
Stars: ✭ 41 (+64%)
Mutual labels:  object
property-seeker
Calculate the price range for property advertised on Domain and Real Estate.
Stars: ✭ 30 (+20%)
Mutual labels:  property
is-valid-glob
Return true if a value is a valid glob pattern string, or array of glob patterns.
Stars: ✭ 21 (-16%)
Mutual labels:  glob
pykorm
A python 🐍 kubernetes ☸️ ORM πŸš€. Very useful when writing operators for your CRDs with Kopf.
Stars: ✭ 56 (+124%)
Mutual labels:  object
sic
🦜 Accessible image processing and conversion from the terminal. Front-end for image-rs/image.
Stars: ✭ 96 (+284%)
Mutual labels:  glob
jackson-dynamic-filter
An easy way to determine filters dynamically using Jackson
Stars: ✭ 35 (+40%)
Mutual labels:  property

glob-object NPM version NPM monthly downloads NPM total downloads Linux Build Status

Filter an object using glob patterns and dot notation.

Install

Install with npm:

$ npm install --save glob-object

Usage

var globObject = require('glob-object');

globObject('a.*.f', {a: {b: {c: 'd'}, e: {f: 'g'}}});
//=> { a: { e: { f: 'g' } } }

Examples

Given the following object:

var obj = {
  a: {
    b: {
      c: 'd',
      e: 'f',
      g: 'h',
      i: {j: 'k'},
      l: {g: 'k'}
    },
    i: 'j'
  }
};

match properties using wildcards

globObject('*', obj);
//=> obj (matches all keys)

match properties using braces

globObject('a.*.{c,e}', obj);
//=> {a: {b: {c: 'd', e: 'f'}}}

match a nested property using a wildcard

A single star will match one level of the object:

globObject('a.*.g', obj);
//=> {a: {b: {g: 'h'}}}

match deep properties using globstars

A double star will match to any depth (note that the single star in the previous example did not match a.b.l.g):

globObject('a.**.g', obj);
//=> {a: {b: {g: 'h', l: {g: 'k'}}}}

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright Β© 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on June 19, 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].