object-values
Advanced tools
Comparing version
11
index.js
'use strict'; | ||
module.exports = function (obj) { | ||
var keys = Object.keys(obj); | ||
var ret = []; | ||
for (var i = 0; i < keys.length; i++) { | ||
ret.push(obj[keys[i]]); | ||
} | ||
return ret; | ||
}; | ||
module.exports = object => Object.keys(object).map(i => object[i]); |
{ | ||
"name": "object-values", | ||
"version": "1.0.0", | ||
"description": "Get the values of an object", | ||
"license": "MIT", | ||
"repository": "sindresorhus/object-values", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"object", | ||
"values", | ||
"obj", | ||
"val", | ||
"properties", | ||
"browser" | ||
], | ||
"devDependencies": { | ||
"mocha": "*" | ||
} | ||
"name": "object-values", | ||
"version": "2.0.0", | ||
"description": "Get the values of an object", | ||
"license": "MIT", | ||
"repository": "sindresorhus/object-values", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"object", | ||
"values", | ||
"value", | ||
"properties" | ||
], | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
} |
@@ -7,8 +7,10 @@ # object-values [](https://travis-ci.org/sindresorhus/object-values) | ||
If you target Node.js 8 or higher, just use [`Object.values()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Object/values) instead. | ||
## Install | ||
```sh | ||
$ npm install --save object-values | ||
``` | ||
$ npm install object-values | ||
``` | ||
@@ -19,2 +21,4 @@ | ||
```js | ||
const objectValues = require('object-values'); | ||
objectValues({foo: 0, bar: 1}); | ||
@@ -27,2 +31,2 @@ //=> [0, 1] | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2328
98.8%4
33.33%30
15.38%2
100%2
-77.78%