
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@codefeathers/infinity
Advanced tools
Infinitely generating linked list with memoisation (or an n-generator)
Create infinite linked lists in JavaScript. Each item is linked to the next and previous item.
This can also be used as an nth generator with a pure interface (see example).
Node:
npm install --save @codefeathers/infinity
In the browser:
<script src="https://unpkg.com/@codefeathers/infinity">
// Initialise a new InfiniteList using the constructor.
// `start` is any value.
// `next` is a pure function that accepts current
// (and optionally previous) value in the series
const infinity = new InfiniteList(<start:Number>, <next:Function>);
// Gets item at index
infinity.get(<index:Number>);
// Equivalent to the above! (Modern browsers and node only)
infinity[<index:Number>];
// Returns array of given number of InfiniteListItems from index 0
infinity.take(<number:Number>);
// Returns array of InfiniteListItems from index startIndex to endIndex
infinity.take(<startIndex:Number>, <endIndex:Number>);
// Get InfiniteListItem at next index. Optional number of indices to move ahead
infinity.get(<index:Number>).next(<number:Number>);
// Get InfiniteListItem at previous index. Optional number of indices to move backward
infinity.get(<index:Number>).previous(<number:Number>);
You can pass in any starting value. infinity
cheerfully ignores what you pass in there. The next
function gets current value and (optionally) previous value as arguments to find next value.
InfiniteList
is iterable.
// (Modern browsers and node only)
for (let item of infinity) {
// Remember to have an exit condition
console.log(item);
}
const InfiniteList = require('@codefeathers/infinity');
const { log } = console;
const next = (cur, prev) => cur + ((!prev && prev !== 0) ? 1 : prev);
const fibonacci = new InfiniteList(0, next);
// Take the first ten numbers from fibonacci series
log(fibonacci.take(10).map(x => x.value)); // -> [ 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 ]
// What's the 50th item?
log(fibonacci.get(50).value); // -> 12586269025
// This is equivalent of the above! (modern browsers only!)
log(fibonacci[50].value); // -> 12586269025
// What's the next item?
log(fibonacci.get(50).next().value); // -> 20365011074
// What's 5 places after?
log(fibonacci.get(50).next(5).value); // -> 139583862445
// To Infinity and beyond!
log(fibonacci.last().value); // -> Infinity
FAQs
Infinitely generating linked list with memoisation (or an n-generator)
The npm package @codefeathers/infinity receives a total of 2 weekly downloads. As such, @codefeathers/infinity popularity was classified as not popular.
We found that @codefeathers/infinity 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.