Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Hashish is a node.js library for manipulating hash data structures. It is distilled from the finest that ruby, perl, and haskell have to offer by way of hash/map interfaces.
Hashish provides a chaining interface, where you can do:
var Hash = require('hashish');
Hash({ a : 1, b : 2, c : 3, d : 4 })
.map(function (x) { return x * 10 })
.filter(function (x) { return x < 30 })
.forEach(function (x, key) {
console.log(key + ' => ' + x);
})
;
Output:
a => 10
b => 20
Some functions and attributes in the chaining interface are terminal, like
.items
or .detect()
. They return values of their own instead of the chain
context.
Each function in the chainable interface is also attached to Hash
in chainless
form:
var Hash = require('hashish');
var obj = { a : 1, b : 2, c : 3, d : 4 };
var mapped = Hash.map(obj, function (x) {
return x * 10
});
console.dir(mapped);
Output:
{ a: 10, b: 20, c: 30, d: 40 }
In either case, the 'this' context of the function calls is the same object that the chained functions return, so you can make nested chains.
For each key/value in the hash, calls cb(value, key)
.
For each key/value in the hash, calls cb(value, key)
.
The return value of cb
is the new value at key
in the resulting hash.
For each key/value in the hash, calls cb(value, key)
.
The resulting hash omits key/value pairs where cb
returned a falsy value.
Returns the first value in the hash for which cb(value, key)
is non-falsy.
Order of hashes is not well-defined so watch out for that.
Returns the accumulated value of a left-fold over the key/value pairs.
Returns a boolean: whether or not cb(value, key)
ever returned a non-falsy
value.
Mutate the context hash, merging the key/value pairs from the passed objects
and overwriting keys from the context hash if the current obj
has keys of
the same name. Falsy arguments are silently ignored.
Like multi-argument update()
but operate on an array directly.
Merge the key/value pairs from the passed objects into the resultant hash without modifying the context hash. Falsy arguments are silently ignored.
Like multi-argument merge()
but operate on an array directly.
Return whether the hash has a key, key
.
Return an Array with the values at the keys from keys
.
Call cb
with the present raw hash.
This function is chainable.
Filter by including only those keys in keys
in the resulting hash.
Filter by excluding those keys in keys
in the resulting hash.
These are attributes in the chaining interface and functions in the Hash.xxx
interface.
Return all the enumerable attribute keys in the hash.
Return all the enumerable attribute values in the hash.
Filter out values which are === undefined
.
Make a deep copy of the hash.
Make a shallow copy of the hash.
Return the number of key/value pairs in the hash.
Note: use Hash.size()
for non-chain mode.
Alias for length
since Hash.length
is masked by Function.prototype
.
See also creationix's pattern/hash, which does a similar thing except with hash inputs and array outputs.
To install with npm:
npm install hashish
To run the tests with expresso:
expresso
FAQs
Hash data structure manipulation functions
The npm package hashish receives a total of 72,413 weekly downloads. As such, hashish popularity was classified as popular.
We found that hashish demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.