
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
array-iter-next-crnt
Advanced tools
Get array items one-by-one and remember the current one.
from test/take2dict.js:
var iter = require('array-iter-next-crnt'), list, it, dict,
expectEqual = require('equal-pmb'), expected;
list = [ 'animals', 3, 'bird', 'cat', 'horse',
'tooFew', 9001,
'empty', 0,
'alpha', 5, 'a', 'b', 'c', // misleading notation in order to
'nums', 0, 1, 2, 3, 4, // show that it doesn't matter
'fruit', 2, 'banana', 'pear',
];
it = iter(list);
dict = {};
it.each(function (key) {
expectEqual(it, this);
expectEqual(it.crnt, key);
var nextUp = it.peek(), howMany;
expectEqual(it.next(), it);
howMany = it.crnt;
expectEqual(nextUp, howMany);
dict[key] = it.take(howMany);
});
expected = {
animals: [ 'bird', 'cat', 'horse' ],
tooFew: false,
empty: [],
alpha: [ 'a', 'b', 'c', 'nums', 0 ], // took 5, as expected.
'1': [ 3, 4 ],
fruit: [ 'banana', 'pear' ],
};
expectEqual(dict, expected);
In scenarios where you know that all your values are truthy and you don't mind coding style:
while (x = myIter()) { console.log(x); }
ISC
FAQs
Get array items one-by-one and remember the current one.
The npm package array-iter-next-crnt receives a total of 2 weekly downloads. As such, array-iter-next-crnt popularity was classified as not popular.
We found that array-iter-next-crnt 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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.