Security News
RubyGems.org Adds New Maintainer Role
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.
array-walker
Advanced tools
Traverses a multi-dimensional array and fires off a callback with a value and its relationship.
let walker = require('array-walker');
// A single-dimensional array
walker(['a', 'b'], (value, key) => console.log(value, key));
// a, 0
// b, 1
// A two-dimensional array
walker([['a', 'b'], ['c', 'd']], (value, x, y) => console.log(value, x, y));
// a, 0, 0
// b, 0, 1
// c, 1, 0
// d, 1, 1
// A 12-dimensional array
walker(
[[[[[[[[[[[['a', 'b']]]]]], 'c']]]]]],
(value, ...lineage) => console.log(value, ...lineage)
);
// a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
// b, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
// c, 0, 0, 0, 0, 0, 1
// With context
walker(['a', 'b'], callbackWithContext, {example: "The Answer"});
// The Answer, a, 0
// The Answer, b, 1
function callbackWithContext(value, key) {
console.log(this.example, value, key);
}
$ npm install array-walker
var walker = require('array-walker');
Type | Data Type | Name | Description |
---|---|---|---|
parameter | *[] | items | The array to walk. |
parameter | function | observationCallback | The function to call when a non-array value is found. |
parameter | * | The context passed to the callback | |
parameter | ...number | [lineage] | The parent indexes. |
returns | undefined | n/a | n/a |
The observation callback is fired when a non-array value is found.
Type | Data Type | Name | Description |
---|---|---|---|
this | * | this | The context passed to the walker |
parameter | !*[] | value | The value that was discovered. |
parameter | ...number | lineage | The indexes in each dimension of the array. |
returns | undefined | n/a | n/a |
FAQs
Multi-dimensional array walker with observation
The npm package array-walker receives a total of 0 weekly downloads. As such, array-walker popularity was classified as not popular.
We found that array-walker 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
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.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.