├── .editorconfig ├── .eslintrc.json ├── .gitattributes ├── .gitignore ├── .travis.yml ├── .verb.md ├── LICENSE ├── README.md ├── example.js ├── index.js ├── package.json └── test ├── reducePaths.js └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | end_of_line = lf 6 | charset = utf-8 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [{**/{actual,fixtures,expected,templates}/**,*.md}] 12 | trim_trailing_whitespace = false 13 | insert_final_newline = false -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaFeatures": { 3 | "modules": true, 4 | "experimentalObjectRestSpread": true 5 | }, 6 | 7 | "env": { 8 | "browser": false, 9 | "es6": true, 10 | "node": true, 11 | "mocha": true 12 | }, 13 | 14 | "globals": { 15 | "document": false, 16 | "navigator": false, 17 | "window": false 18 | }, 19 | 20 | "rules": { 21 | "accessor-pairs": 2, 22 | "arrow-spacing": [2, { "before": true, "after": true }], 23 | "block-spacing": [2, "always"], 24 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 25 | "comma-dangle": [2, "never"], 26 | "comma-spacing": [2, { "before": false, "after": true }], 27 | "comma-style": [2, "last"], 28 | "constructor-super": 2, 29 | "curly": [2, "multi-line"], 30 | "dot-location": [2, "property"], 31 | "eol-last": 2, 32 | "eqeqeq": [2, "allow-null"], 33 | "generator-star-spacing": [2, { "before": true, "after": true }], 34 | "handle-callback-err": [2, "^(err|error)$" ], 35 | "indent": [2, 2, { "SwitchCase": 1 }], 36 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 37 | "keyword-spacing": [2, { "before": true, "after": true }], 38 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 39 | "new-parens": 2, 40 | "no-array-constructor": 2, 41 | "no-caller": 2, 42 | "no-class-assign": 2, 43 | "no-cond-assign": 2, 44 | "no-const-assign": 2, 45 | "no-control-regex": 2, 46 | "no-debugger": 2, 47 | "no-delete-var": 2, 48 | "no-dupe-args": 2, 49 | "no-dupe-class-members": 2, 50 | "no-dupe-keys": 2, 51 | "no-duplicate-case": 2, 52 | "no-empty-character-class": 2, 53 | "no-eval": 2, 54 | "no-ex-assign": 2, 55 | "no-extend-native": 2, 56 | "no-extra-bind": 2, 57 | "no-extra-boolean-cast": 2, 58 | "no-extra-parens": [2, "functions"], 59 | "no-fallthrough": 2, 60 | "no-floating-decimal": 2, 61 | "no-func-assign": 2, 62 | "no-implied-eval": 2, 63 | "no-inner-declarations": [2, "functions"], 64 | "no-invalid-regexp": 2, 65 | "no-irregular-whitespace": 2, 66 | "no-iterator": 2, 67 | "no-label-var": 2, 68 | "no-labels": 2, 69 | "no-lone-blocks": 2, 70 | "no-mixed-spaces-and-tabs": 2, 71 | "no-multi-spaces": 2, 72 | "no-multi-str": 2, 73 | "no-multiple-empty-lines": [2, { "max": 1 }], 74 | "no-native-reassign": 0, 75 | "no-negated-in-lhs": 2, 76 | "no-new": 2, 77 | "no-new-func": 2, 78 | "no-new-object": 2, 79 | "no-new-require": 2, 80 | "no-new-wrappers": 2, 81 | "no-obj-calls": 2, 82 | "no-octal": 2, 83 | "no-octal-escape": 2, 84 | "no-proto": 0, 85 | "no-redeclare": 2, 86 | "no-regex-spaces": 2, 87 | "no-return-assign": 2, 88 | "no-self-compare": 2, 89 | "no-sequences": 2, 90 | "no-shadow-restricted-names": 2, 91 | "no-spaced-func": 2, 92 | "no-sparse-arrays": 2, 93 | "no-this-before-super": 2, 94 | "no-throw-literal": 2, 95 | "no-trailing-spaces": 0, 96 | "no-undef": 2, 97 | "no-undef-init": 2, 98 | "no-unexpected-multiline": 2, 99 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 100 | "no-unreachable": 2, 101 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 102 | "no-useless-call": 0, 103 | "no-with": 2, 104 | "one-var": [0, { "initialized": "never" }], 105 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], 106 | "padded-blocks": [0, "never"], 107 | "quotes": [2, "single", "avoid-escape"], 108 | "radix": 2, 109 | "semi": [2, "always"], 110 | "semi-spacing": [2, { "before": false, "after": true }], 111 | "space-before-blocks": [2, "always"], 112 | "space-before-function-paren": [2, "never"], 113 | "space-in-parens": [2, "never"], 114 | "space-infix-ops": 2, 115 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 116 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 117 | "use-isnan": 2, 118 | "valid-typeof": 2, 119 | "wrap-iife": [2, "any"], 120 | "yoda": [2, "never"] 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | * text eol=lf 3 | 4 | # binaries 5 | *.ai binary 6 | *.psd binary 7 | *.jpg binary 8 | *.gif binary 9 | *.png binary 10 | *.jpeg binary 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # always ignore files 2 | *.DS_Store 3 | *.sublime-* 4 | 5 | # test related, or directories generated by tests 6 | test/actual 7 | actual 8 | coverage 9 | .nyc* 10 | 11 | # npm 12 | node_modules 13 | npm-debug.log 14 | 15 | # yarn 16 | yarn.lock 17 | yarn-error.log 18 | 19 | # misc 20 | _gh_pages 21 | _draft 22 | _drafts 23 | bower_components 24 | vendor 25 | temp 26 | tmp 27 | TODO.md 28 | package-lock.json -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | os: 3 | - linux 4 | - osx 5 | language: node_js 6 | node_js: 7 | - node 8 | - '8' 9 | - '7' 10 | - '6' 11 | - '5' 12 | - '4' 13 | - '0.12' 14 | - '0.10' 15 | matrix: 16 | allow_failures: [] 17 | fast_finish: true 18 | -------------------------------------------------------------------------------- /.verb.md: -------------------------------------------------------------------------------- 1 | ## Usage 2 | 3 | ```js 4 | var globObject = require('{%= name %}'); 5 | 6 | globObject('a.*.f', {a: {b: {c: 'd'}, e: {f: 'g'}}}); 7 | //=> { a: { e: { f: 'g' } } } 8 | ``` 9 | 10 | ## Examples 11 | 12 | Given the following object: 13 | 14 | ```js 15 | var obj = { 16 | a: { 17 | b: { 18 | c: 'd', 19 | e: 'f', 20 | g: 'h', 21 | i: {j: 'k'}, 22 | l: {g: 'k'} 23 | }, 24 | i: 'j' 25 | } 26 | }; 27 | ``` 28 | 29 | ## match properties using wildcards 30 | 31 | ```js 32 | globObject('*', obj); 33 | //=> obj (matches all keys) 34 | ``` 35 | 36 | ## match properties using braces 37 | 38 | ```js 39 | globObject('a.*.{c,e}', obj); 40 | //=> {a: {b: {c: 'd', e: 'f'}}} 41 | ``` 42 | 43 | ## match a nested property using a wildcard 44 | 45 | A single star will match one level of the object: 46 | 47 | ```js 48 | globObject('a.*.g', obj); 49 | //=> {a: {b: {g: 'h'}}} 50 | ``` 51 | 52 | ## match deep properties using globstars 53 | 54 | A double star will match to any depth (note that the single star in the previous example did not match `a.b.l.g`): 55 | 56 | ```js 57 | globObject('a.**.g', obj); 58 | //=> {a: {b: {g: 'h', l: {g: 'k'}}}} 59 | ``` 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2017, Jon Schlinkert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # glob-object [![NPM version](https://img.shields.io/npm/v/glob-object.svg?style=flat)](https://www.npmjs.com/package/glob-object) [![NPM monthly downloads](https://img.shields.io/npm/dm/glob-object.svg?style=flat)](https://npmjs.org/package/glob-object) [![NPM total downloads](https://img.shields.io/npm/dt/glob-object.svg?style=flat)](https://npmjs.org/package/glob-object) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/glob-object.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/glob-object) 2 | 3 | > Filter an object using glob patterns and dot notation. 4 | 5 | ## Install 6 | 7 | Install with [npm](https://www.npmjs.com/): 8 | 9 | ```sh 10 | $ npm install --save glob-object 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | var globObject = require('glob-object'); 17 | 18 | globObject('a.*.f', {a: {b: {c: 'd'}, e: {f: 'g'}}}); 19 | //=> { a: { e: { f: 'g' } } } 20 | ``` 21 | 22 | ## Examples 23 | 24 | Given the following object: 25 | 26 | ```js 27 | var obj = { 28 | a: { 29 | b: { 30 | c: 'd', 31 | e: 'f', 32 | g: 'h', 33 | i: {j: 'k'}, 34 | l: {g: 'k'} 35 | }, 36 | i: 'j' 37 | } 38 | }; 39 | ``` 40 | 41 | ## match properties using wildcards 42 | 43 | ```js 44 | globObject('*', obj); 45 | //=> obj (matches all keys) 46 | ``` 47 | 48 | ## match properties using braces 49 | 50 | ```js 51 | globObject('a.*.{c,e}', obj); 52 | //=> {a: {b: {c: 'd', e: 'f'}}} 53 | ``` 54 | 55 | ## match a nested property using a wildcard 56 | 57 | A single star will match one level of the object: 58 | 59 | ```js 60 | globObject('a.*.g', obj); 61 | //=> {a: {b: {g: 'h'}}} 62 | ``` 63 | 64 | ## match deep properties using globstars 65 | 66 | A double star will match to any depth (note that the single star in the previous example did not match `a.b.l.g`): 67 | 68 | ```js 69 | globObject('a.**.g', obj); 70 | //=> {a: {b: {g: 'h', l: {g: 'k'}}}} 71 | ``` 72 | 73 | ## About 74 | 75 | ### Related projects 76 | 77 | * [expand-object](https://www.npmjs.com/package/expand-object): Expand a string into a JavaScript object using a simple notation. Use the CLI or… [more](https://github.com/jonschlinkert/expand-object) | [homepage](https://github.com/jonschlinkert/expand-object "Expand a string into a JavaScript object using a simple notation. Use the CLI or as a node.js lib.") 78 | * [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") 79 | * [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://github.com/jonschlinkert/has-value) | [homepage](https://github.com/jonschlinkert/has-value "Returns true if a value exists, false if empty. Works with deeply nested values using object paths.") 80 | * [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") 81 | * [stringify-keys](https://www.npmjs.com/package/stringify-keys): Build an array of key paths from an object. | [homepage](https://github.com/doowb/stringify-keys "Build an array of key paths from an object.") 82 | 83 | ### Contributing 84 | 85 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). 86 | 87 | ### Building docs 88 | 89 | _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ 90 | 91 | To generate the readme, run the following command: 92 | 93 | ```sh 94 | $ npm install -g verbose/verb#dev verb-generate-readme && verb 95 | ``` 96 | 97 | ### Running tests 98 | 99 | 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: 100 | 101 | ```sh 102 | $ npm install && npm test 103 | ``` 104 | 105 | ### Author 106 | 107 | **Jon Schlinkert** 108 | 109 | * [github/jonschlinkert](https://github.com/jonschlinkert) 110 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert) 111 | 112 | ### License 113 | 114 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). 115 | Released under the [MIT License](LICENSE). 116 | 117 | *** 118 | 119 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 19, 2017._ -------------------------------------------------------------------------------- /example.js: -------------------------------------------------------------------------------- 1 | var globObject = require('./'); 2 | 3 | console.log(globObject('a.*.f', {a: {b: {c: 'd'}, e: {f: 'g'}}})); 4 | //=> { a: { e: { f: 'g' } } } 5 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * glob-object 3 | * 4 | * Copyright (c) 2015-2017, Jon Schlinkert. 5 | * Released under the MIT License. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var stringify = require('stringify-keys'); 11 | var unique = require('arr-unique'); 12 | var clone = require('clone-deep'); 13 | var unset = require('unset-value'); 14 | var get = require('get-value'); 15 | var set = require('set-value'); 16 | var mm = require('micromatch'); 17 | 18 | function globObject(patterns, obj, options) { 19 | var cloned = clone(obj); 20 | var keys = stringify(cloned, '/'); 21 | 22 | patterns = arrayify(patterns).map(toSlashes); 23 | var negated = false; 24 | 25 | for (var i = 0; i < patterns.length; i++) { 26 | var pattern = patterns[i]; 27 | if (pattern.charAt(0) === '!') { 28 | negated = true; 29 | patterns.splice(1, i); 30 | var m = mm(keys, pattern.slice(1), options); 31 | var len = m.length; 32 | var idx = -1; 33 | while (++idx < len) { 34 | unset(cloned, toDots(m[idx])); 35 | } 36 | } 37 | } 38 | 39 | // re-create keys if any negation patterns were passed 40 | if (negated) { 41 | keys = stringify(cloned, '/'); 42 | } 43 | 44 | var matches = mm(keys, patterns, options); 45 | 46 | return matches.reduce(function(acc, path) { 47 | var key = toDots(path); 48 | set(acc, key, get(cloned, key)); 49 | return acc; 50 | }, {}); 51 | } 52 | 53 | function reducePaths(paths) { 54 | for (var i = 0; i < paths.length; i++) { 55 | var key = paths[i]; 56 | var arr = removeElement(paths, key); 57 | var diff = paths.length - arr.length; 58 | if (diff > 0) { 59 | paths = arr; 60 | } 61 | } 62 | return unique(paths).sort(); 63 | } 64 | 65 | function removeElement(paths, key) { 66 | var arr = paths.slice(); 67 | var len = arr.length; 68 | var idx = -1; 69 | 70 | while (++idx < len) { 71 | var fp = arr[idx]; 72 | if (fp.indexOf(key) === 0 && fp !== key) { 73 | arr.splice(arr.indexOf(fp), 1); 74 | len--; 75 | } 76 | } 77 | return arr; 78 | } 79 | 80 | function toSlashes(key) { 81 | return key.split('.').join('/'); 82 | } 83 | 84 | function toDots(key) { 85 | return key.split('/').join('.'); 86 | } 87 | 88 | function arrayify(val) { 89 | return val ? (Array.isArray(val) ? val : [val]) : []; 90 | } 91 | 92 | /** 93 | * Expose `reducePaths` for unit tests 94 | */ 95 | 96 | globObject.reducePaths = reducePaths; 97 | 98 | /** 99 | * Expose `globObject` 100 | */ 101 | 102 | module.exports = globObject; 103 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "glob-object", 3 | "description": "Filter an object using glob patterns and dot notation.", 4 | "version": "1.0.0", 5 | "homepage": "https://github.com/jonschlinkert/glob-object", 6 | "author": "Jon Schlinkert (https://github.com/jonschlinkert)", 7 | "repository": "jonschlinkert/glob-object", 8 | "bugs": { 9 | "url": "https://github.com/jonschlinkert/glob-object/issues" 10 | }, 11 | "license": "MIT", 12 | "files": [ 13 | "index.js" 14 | ], 15 | "main": "index.js", 16 | "engines": { 17 | "node": ">=0.10.0" 18 | }, 19 | "scripts": { 20 | "test": "mocha" 21 | }, 22 | "dependencies": { 23 | "arr-unique": "^1.0.2", 24 | "clone-deep": "^0.3.0", 25 | "get-value": "^2.0.6", 26 | "micromatch": "^3.0.3", 27 | "set-value": "^1.0.0", 28 | "stringify-keys": "^0.3.0", 29 | "unset-value": "^1.0.0" 30 | }, 31 | "keywords": [ 32 | "dot", 33 | "filter", 34 | "get", 35 | "glob", 36 | "globstar", 37 | "key", 38 | "keys", 39 | "match", 40 | "notation", 41 | "object", 42 | "object-path", 43 | "path", 44 | "paths", 45 | "pattern", 46 | "set", 47 | "star", 48 | "wildcard" 49 | ], 50 | "verb": { 51 | "run": true, 52 | "toc": false, 53 | "layout": "default", 54 | "tasks": [ 55 | "readme" 56 | ], 57 | "plugins": [ 58 | "gulp-format-md" 59 | ], 60 | "related": { 61 | "list": [ 62 | "expand-object", 63 | "get-value", 64 | "has-value", 65 | "set-value", 66 | "stringify-keys" 67 | ] 68 | }, 69 | "reflinks": [ 70 | "verb" 71 | ], 72 | "lint": { 73 | "reflinks": true 74 | } 75 | }, 76 | "devDependencies": { 77 | "gulp-format-md": "^0.1.12", 78 | "mocha": "^3.4.2" 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /test/reducePaths.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('mocha'); 4 | var assert = require('assert'); 5 | var glob = require('..'); 6 | var reduce = glob.reducePaths; 7 | 8 | describe('reducePaths utility', function() { 9 | it('should match properties using braces:', function() { 10 | assert.deepEqual(reduce(['a/a', 'a', 'a/b/c', 'b']), ['a', 'b']); 11 | assert.deepEqual(reduce(['a/a', 'a', 'a/b/c', 'b/c']), ['a', 'b/c']); 12 | assert.deepEqual(reduce(['a/a', 'a', 'a/b/c', 'b/c', 'b']), ['a', 'b']); 13 | assert.deepEqual(reduce(['a/a', 'a', 'a/b/c', 'b/c', 'b', 'b/b/b/']), ['a', 'b']); 14 | assert.deepEqual(reduce(['b/a/b', 'b/a', 'a/b/c']), ['a/b/c', 'b/a']); 15 | assert.deepEqual(reduce(['a', 'b/a/b', 'b/a', 'a']), ['a', 'b/a']); 16 | assert.deepEqual(reduce(['a', 'b/a/b', 'b/a/c', 'a']), ['a', 'b/a/b', 'b/a/c']); 17 | assert.deepEqual(reduce(['a', 'c', 'b/a', 'a']), ['a', 'b/a', 'c']); 18 | assert.deepEqual(reduce(['a/a', 'c', 'b/a', 'a']), ['a', 'b/a', 'c']); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * glob-object 3 | * 4 | * Copyright (c) 2015-2017, Jon Schlinkert. 5 | * Released under the MIT License. 6 | */ 7 | 8 | 'use strict'; 9 | 10 | require('mocha'); 11 | var assert = require('assert'); 12 | var glob = require('..'); 13 | 14 | var fixture = { 15 | a: { 16 | b: { 17 | c: 'd', 18 | e: 'f', 19 | g: 'h', 20 | i: {j: 'k'}, 21 | l: {g: 'k'} 22 | }, 23 | i: 'j' 24 | } 25 | }; 26 | 27 | describe('glob', function() { 28 | it('should match properties using wildcards:', function() { 29 | assert.deepEqual(glob('a.*', fixture), fixture); 30 | }); 31 | 32 | it('should match properties using negation patterns:', function() { 33 | assert.deepEqual(glob('!a', fixture), {}); 34 | assert.deepEqual(glob(['!a', 'a.b.c'], {a: {b: 'c', d: 'e'}}), {}); 35 | assert.deepEqual(glob(['!a.*'], {a: {b: 'c', d: 'e'}}), {a: {}}); 36 | assert.deepEqual(glob(['!a.b.[g-l]'], fixture), { 37 | a: { 38 | b: { 39 | c: 'd', 40 | e: 'f' 41 | }, 42 | i: 'j' 43 | } 44 | }); 45 | assert.deepEqual(glob('!a.b.c', fixture), { 46 | a: { 47 | b: { 48 | e: 'f', 49 | g: 'h', 50 | i: {j: 'k'}, 51 | l: {g: 'k'} 52 | }, 53 | i: 'j' 54 | } 55 | }); 56 | }); 57 | 58 | it('should match properties using braces:', function() { 59 | assert.deepEqual(glob('*.{b,i}', fixture), fixture); 60 | assert.deepEqual(glob('a.*.{c,e}', fixture), {a: {b: {c: 'd', e: 'f'}}}); 61 | }); 62 | 63 | it('should match a nested property using a wildcard:', function() { 64 | assert.deepEqual(glob('a.*.g', fixture), {a: {b: {g: 'h'}}}); 65 | }); 66 | 67 | it('should match deep properties using globstars', function() { 68 | assert.deepEqual(glob('a.**.g', fixture), {a: {b: {g: 'h', l: {g: 'k'}}}}); 69 | }); 70 | }); 71 | --------------------------------------------------------------------------------