New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

filter-values

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-values - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

25

index.js

@@ -9,4 +9,3 @@ /*!

var forOwn = require('for-own');
var iterator = require('make-iterator');
var mm = require('micromatch');
var matcher = require('is-match');

@@ -18,12 +17,13 @@ /**

* @param {Object} `obj`
* @param {Function|Array|String} `filter`
* @param {Object} `thisArg`
* @param {Function|Array|String|RegExp} `filter`
* @param {Object} `options` pass options to `micromatch`
* @return {Object}
*/
module.exports = function filterValues(obj, filter, thisArg) {
var cb = matcher(filter, thisArg);
module.exports = function filterValues(obj, filter, options) {
var isMatch = matcher(filter, options);
var res = {};
forOwn(obj, function (val, key, o) {
if (cb(val, key, o)) {
forOwn(obj, function (val, key) {
if (isMatch(val)) {
res[key] = val;

@@ -34,10 +34,1 @@ }

};
function matcher(filter, thisArg) {
if (Array.isArray(filter) || typeof filter === 'string') {
return function (val) {
return !!mm(val, filter).length;
};
}
return iterator(filter, thisArg)
}
{
"name": "filter-values",
"description": "Filter an object values using glob patterns or with a `callback` function returns true. ",
"version": "0.2.0",
"version": "0.3.0",
"homepage": "https://github.com/jonschlinkert/filter-values",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/filter-values.git"
},
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"repository": "jonschlinkert/filter-values",
"bugs": {
"url": "https://github.com/jonschlinkert/filter-values/issues"
},
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/filter-values/blob/master/LICENSE"
},
"license": "MIT",
"files": [

@@ -31,2 +22,6 @@ "index.js"

},
"dependencies": {
"for-own": "^0.1.3",
"is-match": "^0.2.0"
},
"devDependencies": {

@@ -58,3 +53,14 @@ "mocha": "*",

"wildcard"
]
],
"verb": {
"related": {
"list": [
"filter-object",
"filter-values",
"micromatch",
"rename-keys",
"sort-object"
]
}
}
}

@@ -1,9 +0,9 @@

# filter-values [![NPM version](https://badge.fury.io/js/filter-values.svg)](http://badge.fury.io/js/filter-values) [![Build Status](https://travis-ci.org/jonschlinkert/filter-values.svg)](https://travis-ci.org/jonschlinkert/filter-values)
# filter-values [![NPM version](https://badge.fury.io/js/filter-values.svg)](http://badge.fury.io/js/filter-values) [![Build Status](https://travis-ci.org/jonschlinkert/filter-values.svg)](https://travis-ci.org/jonschlinkert/filter-values)
> Filter an object values using glob patterns or with a `callback` function returns true.
> Filter an object values using glob patterns or with a `callback` function returns true.
## Install with [npm](npmjs.org)
Install with [npm](https://www.npmjs.com/)
```bash
npm i filter-values --save
```sh
$ npm i filter-values --save
```

@@ -21,3 +21,2 @@

filter({a: 'a', b: 'b', c: 'c'}, function(value, key, obj) {

@@ -41,18 +40,20 @@ return key === 'b';

## Related
* [filter-object](https://github.com/jonschlinkert/filter-object): Return a copy of an object, filtered to have only keys that match the given glob patterns.
* [filter-values](https://github.com/jonschlinkert/filter-values): Filter an object to have only the `own` properties for which a `callback` function returns true.
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just use `micromatch.isMatch()` instead of `minimatch()`, or use `micromatch()` instead of `multimatch()`.
* [rename-keys](https://github.com/jonschlinkert/rename-keys): Modify the names of the own enumerable properties (keys) of an object.
* [sort-object](https://github.com/doowb/sort-object): Sort the keys in an object.
* [filter-object](https://github.com/jonschlinkert/filter-object): Return a copy of an object, filtered to have only keys that match the given… [more](https://github.com/jonschlinkert/filter-object)
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://github.com/jonschlinkert/micromatch)
* [rename-keys](https://github.com/jonschlinkert/rename-keys): Modify the names of the own enumerable properties (keys) of an object.
* [sort-object](https://github.com/doowb/sort-object): Sort the keys in an object.
## Running tests
Install dev dependencies:
```bash
npm i -d && npm test
```sh
$ npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/filter-values/issues)
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/filter-values/issues/new)
## Author

@@ -63,10 +64,11 @@

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 31, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 13, 2015._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc