filter-object
Advanced tools
Comparing version 0.2.0 to 1.0.0
17
.verb.md
@@ -6,10 +6,4 @@ # {%= name %} {%= badge("fury") %} | ||
## Install | ||
{%= include("install") %} | ||
{%= include("install-npm", {save: true}) %} | ||
## Run tests | ||
```bash | ||
npm test | ||
``` | ||
## Usage | ||
@@ -50,2 +44,11 @@ | ||
## Run tests | ||
Install dev dependencies: | ||
```bash | ||
npm i -d && mocha | ||
``` | ||
## Contributing | ||
@@ -52,0 +55,0 @@ Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %}). |
{ | ||
"name": "filter-object", | ||
"description": "Return a copy of an object, filtered to have only keys that match the given glob patterns.", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/jonschlinkert/filter-object", | ||
@@ -17,8 +17,6 @@ "author": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/filter-object/blob/master/LICENSE-MIT" | ||
} | ||
], | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/filter-object/blob/master/LICENSE-MIT" | ||
}, | ||
"main": "index.js", | ||
@@ -29,13 +27,12 @@ "engines": { | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
"test": "mocha -R spec", | ||
"lint": "jshint **.js", | ||
"docs": "update && license && verb && deps", | ||
"all": "npm run test && npm run lint && npm run docs" | ||
}, | ||
"dependencies": { | ||
"extend-shallow": "^0.1.1", | ||
"filter-keys": "^0.1.1", | ||
"sort-object": "^0.3.1" | ||
"extend-shallow": "^0.2.0", | ||
"filter-keys": "^1.0.0", | ||
"sort-object": "^0.3.2" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "^4.3.0" | ||
}, | ||
"keywords": [ | ||
@@ -63,6 +60,4 @@ "arr", | ||
"sort", | ||
"util", | ||
"utility", | ||
"wildcard" | ||
] | ||
} | ||
} |
@@ -6,14 +6,8 @@ # filter-object [![NPM version](https://badge.fury.io/js/filter-object.svg)](http://badge.fury.io/js/filter-object) | ||
## Install | ||
### Install with [npm](npmjs.org): | ||
## Install with [npm](npmjs.org) | ||
```bash | ||
npm i filter-object --save-dev | ||
npm i filter-object --save | ||
``` | ||
## Run tests | ||
```bash | ||
npm test | ||
``` | ||
## Usage | ||
@@ -54,2 +48,11 @@ | ||
## Run tests | ||
Install dev dependencies: | ||
```bash | ||
npm i -d && mocha | ||
``` | ||
## Contributing | ||
@@ -71,4 +74,4 @@ Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/filter-object/issues). | ||
_This file was generated by [verb](https://github.com/assemble/verb) on November 24, 2014._ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on December 30, 2014._ | ||
[sort-object]: https://github.com/helpers/sort-object |
24
test.js
/*! | ||
* filter-object <https://github.com/jonschlinkert/filter-object> | ||
* | ||
* Copyright (c) 2014 Jon Schlinkert, contributors. | ||
* Copyright (c) 2014-2015, Jon Schlinkert. | ||
* Licensed under the MIT License | ||
@@ -10,3 +10,3 @@ */ | ||
var should = require('should'); | ||
var assert = require('assert'); | ||
var filter = require('./'); | ||
@@ -16,25 +16,19 @@ | ||
it('should filter keys using the given glob patterns', function () { | ||
filter({a: 'a', b: 'b', c: 'c'}, '*').should.eql({a: 'a', b: 'b', c: 'c'}); | ||
filter({a: 'a', b: 'b', c: 'c'}, 'b').should.eql({b: 'b'}); | ||
filter({foo: 'a', bar: 'b', baz: 'c'}, 'b*').should.eql({bar: 'b', baz: 'c'}); | ||
assert.deepEqual(filter({a: 'a', b: 'b', c: 'c'}, '*'), {a: 'a', b: 'b', c: 'c'}); | ||
assert.deepEqual(filter({a: 'a', b: 'b', c: 'c'}, 'b'), {b: 'b'}); | ||
assert.deepEqual(filter({foo: 'a', bar: 'b', baz: 'c'}, 'b*'), {bar: 'b', baz: 'c'}); | ||
}); | ||
it('should exclude keys that match negation patterns:', function () { | ||
filter({a: 'a', b: 'b', c: 'c'}, ['*', '!a']).should.eql({b: 'b', c: 'c'}); | ||
filter({foo: 'a', bar: 'b', baz: 'c'}, ['*', '!b*']).should.eql({foo: 'a'}); | ||
assert.deepEqual(filter({a: 'a', b: 'b', c: 'c'}, ['*', '!a']), {b: 'b', c: 'c'}); | ||
assert.deepEqual(filter({foo: 'a', bar: 'b', baz: 'c'}, ['*', '!b*']), {foo: 'a'}); | ||
}); | ||
it('should filter keys using brace expansion', function () { | ||
filter({a: 'a', b: 'b', c: 'c'}, '{b,c}').should.eql({b: 'b', c: 'c'}); | ||
assert.deepEqual(filter({a: 'a', b: 'b', c: 'c'}, '{b,c}'), {b: 'b', c: 'c'}); | ||
}); | ||
it('should return the entire object if no pattern is given:', function () { | ||
filter({a: 'a', b: 'b', c: 'c'}).should.eql({a: 'a', b: 'b', c: 'c'}); | ||
assert.deepEqual(filter({a: 'a', b: 'b', c: 'c'}), {a: 'a', b: 'b', c: 'c'}); | ||
}); | ||
it('should throw an error if an object is not passed:', function () { | ||
(function () { | ||
filter() | ||
}).should.throw('filter-object expects an object'); | ||
}); | ||
}); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
0
74
7682
40
+ Addedarr-diff@2.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarray-unique@0.2.1(transitive)
+ Addedbraces@1.8.5(transitive)
+ Addedexpand-brackets@0.1.5(transitive)
+ Addedexpand-range@1.8.2(transitive)
+ Addedextend-shallow@0.2.0(transitive)
+ Addedextglob@0.3.2(transitive)
+ Addedfilename-regex@2.0.1(transitive)
+ Addedfill-range@2.2.4(transitive)
+ Addedfilter-keys@1.1.0(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfor-own@0.1.5(transitive)
+ Addedglob-base@0.3.0(transitive)
+ Addedglob-parent@2.0.0(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-dotfile@1.0.3(transitive)
+ Addedis-equal-shallow@0.1.3(transitive)
+ Addedis-extendable@0.1.1(transitive)
+ Addedis-extglob@1.0.0(transitive)
+ Addedis-glob@2.0.1(transitive)
+ Addedis-number@2.1.04.0.0(transitive)
+ Addedis-posix-bracket@0.1.1(transitive)
+ Addedis-primitive@2.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.0(transitive)
+ Addedkind-of@3.2.26.0.3(transitive)
+ Addedmath-random@1.0.4(transitive)
+ Addedmicromatch@2.3.11(transitive)
+ Addednormalize-path@2.1.1(transitive)
+ Addedobject.omit@2.0.1(transitive)
+ Addedparse-glob@3.0.4(transitive)
+ Addedpreserve@0.2.0(transitive)
+ Addedrandomatic@3.1.1(transitive)
+ Addedregex-cache@0.4.4(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
- Removedarray-differ@1.0.0(transitive)
- Removedarray-union@1.0.2(transitive)
- Removedarray-uniq@1.0.3(transitive)
- Removedextend-shallow@0.1.1(transitive)
- Removedfilter-keys@0.1.2(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@1.0.0(transitive)
- Removedmultimatch@1.0.1(transitive)
- Removedsigmund@1.0.1(transitive)
Updatedextend-shallow@^0.2.0
Updatedfilter-keys@^1.0.0
Updatedsort-object@^0.3.2