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

just-index

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-index - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

14

index.js

@@ -8,4 +8,4 @@ module.exports = index;

index([], 'id'); // {}
index([], null); // undefined
index({}, 'id'); // undefined
index([], null); // throws
index({}, 'id'); // throws
*/

@@ -15,12 +15,9 @@

if (!Array.isArray(arr)) {
return undefined;
throw new Error('expected an array for first argument');
}
if (typeof key !== 'string') {
return undefined;
if (typeof key != 'string') {
throw new Error('expected a string for second argument');
}
var result = {};
var len = arr.length;
for (var i = 0; i < len; i++) {

@@ -33,4 +30,3 @@ var index = arr[i] && arr[i][key];

}
return result;
}
{
"name": "just-index",
"version": "1.0.0",
"description": "return an object from an array, keyed by the value at the given id",
"version": "2.0.0",
"description":
"return an object from an array, keyed by the value at the given id",
"main": "index.js",

@@ -10,8 +11,3 @@ "scripts": {

"repository": "https://github.com/angus-c/just",
"keywords": [
"array",
"index",
"no-dependencies",
"just"
],
"keywords": ["array", "index", "no-dependencies", "just"],
"author": "Cam Pedersen",

@@ -18,0 +14,0 @@ "license": "MIT",

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