Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
#PinVault.js
A key/value data store built to support using plain objects as keys, with pattern matched retrieval.
#Installation
NPM: npm install pinvault
Bower: bower install pinvault
##Usage
In Node or another CommonJS environment:
var pinvault = require('pinvault');
var vault = pinvault();
In an AMD environment such as RequireJS:
require(['pinvault'], function (pinvault) {
var vault = pinvault();
});
Loaded directly on a webpage:
var vault = pinvault();
###pinvault.add(key, value)
vault.add({gender: 'F'}, 1.684); //matches any plain object with a "gender" property containing "F"
vault.add({address: {zipcode: '95014'}}, 'Cupertino'); //matches any plain object with an "address" property containing a zipcode of 95014
vault.add({active: true}, function () { isActive = true; }); //matches any plain object with an "active" property set to true
vault.add(function () { var iDontKnowWhyIDidThis = 1; }, 10); //only matches on an identical function (string evaluation)
vault.add('StringValue', 0); //only matches on "StringValue"
vault.add({foo: '*'}, true); //matches any object containing a 'foo' property, regardless of value
Returns the collection object for chaining.
Multiple values may be stored under the same key by performing multiple adds. Passing an asterisk as the value of a property will match against objects containing that property, but any value on that property.
###pinvault.remove(key[, value[, returnTotalRemoved]])
Removes the value from the data store using the passed key. If value
is omitted, all values stored under a pattern will be removed.
remove()
will return the total number of items removed from the collection. Otherwise will return the collection object.###pinvault.match(input)
Searches the collection for all entries whose key matches against the input
, ordered by specificity descending (closest match first), index ascending (oldest values first). Returns an array of match detail objects containing the stored data
, the matched pattern
used to store the data, index
order of which it was added, and the specificity
level of the match.
var vault = pinvault();
vault.add({a:1}, 1);
vault.add({a:1, b:2}, 2);
vault.add({a:1, c:3}, 3);
vault.add({a:4, c:3, d:5}, 4);
var result = vault.match({a:1, b:2, c:3});
result
will contain:
[
{
data: 2,
specificity: 2,
index: 1,
pattern: '{"a":1,"b":2}'
},
{
data: 3,
specificity: 2,
index: 2,
pattern: '{"a":1,"c":3}'
},
{
data: 1,
specificity: 1,
index: 0,
pattern: '{"a":1}'
}
]
###pinvault.matchData(input)
Performs the same search as .match(input)
, but returns an array of only the data values.
###pinvault.get(key[, all][, fullDetails])
Returns only the values which exactly match the key (no pattern matching).
get()
will return the last value stored under that key, or undefined
if no values were found.##Running Unit Tests
From inside the repository root, run npm install
to install the NodeUnit dependency.
Run npm test
to execute the complete test suite.
FAQs
A key-value store with partial-object key matching.
The npm package pinvault receives a total of 0 weekly downloads. As such, pinvault popularity was classified as not popular.
We found that pinvault 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.