
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
underscore-keypath
Advanced tools
key-path mechanism extensions for underscore (mixin).
underscore-keypath let you access JavaScript objects and arrays with keypath easily.
var foo = {
bar : {
name : "Cool!"
},
scores : [55, 27, 100, 33]
};
_(foo).valueForKeyPath("bar.name"); // --> "Cool!"
_(foo).setValueForKeyPath("bar.name", "BAR"); // --> sets foo.bar.name as "BAR"
_(foo).valueForKeyPath("scores.@max"); // --> 100
$ npm install underscore-keypath
var _ = require("underscore-keypath");
or you may want to use origianl underscore:
var _ = require("underscore");
require("underscore-keypath"); // it will extend original underscore
in this case, please install "underscore" first.
$ npm install underscore
$ npm install underscore-keypath
Otherwise, underscore-keypath extends separated underscore in sandbox.
$ meteor add jeeeyul:underscore-keypath
$ bower install underscore-keypath
Or just download underscore-keypath.js manually.
var list = [{
name : "foo",
info : {
favoriteColor : "red",
age : 20
}
},{
name : "bar",
info : {
favoriteColor : "green",
age : 17
}
},{
name : "zar",
info : {
favoriteColor : "red",
age : 34
}
}];
_(list).pluckByKeyPath("info.age"); // --> [20, 17, 34]
_(list).sortByKeyPath("info.age"); // --> [{name:"bar", ..}, {name:"foo", ..}, {name:"zar", ..}]
_(list).groupByKeyPath("info.favoriteColor"); // --> {red:2, green:1}
See API Document
FAQs
Adds Key-Path mechanism extensions for underscore
The npm package underscore-keypath receives a total of 22,542 weekly downloads. As such, underscore-keypath popularity was classified as popular.
We found that underscore-keypath demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.