![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
fast-list
Advanced tools
Readme
You've got some thing where you need to push a bunch of stuff into a queue and then shift it out. Or, maybe, you need to pop it out stack-like, but it's not clear at the outset which way it's going to go.
Arrays work for this, but are a bit costly performance-wise in the mixed case. In the pure-stack case (or, as of recent V8 versions, the pure-queue case as well), Arrays are best.
In cases where it's mixed, a linked list implementation can be
significantly faster. See the benchmark scripts in bench/*.js
to
measure the differences.
This lacks a lot of features that arrays have:
If any of this matters for your use case, you're probably better off using an Array object.
If you know that you'll be using it as a stack or a queue exclusively, then you're better off using an Array object.
If you know the eventual size at the offset, then you're definitely better off using an Array.
npm install fast-list
var FastList = require("fast-list")
var list = new FastList()
list.push("foo")
list.unshift("bar")
list.push("baz")
console.log(list.length) // 2
console.log(list.pop()) // baz
console.log(list.shift()) // bar
console.log(list.shift()) // foo
push
: Just like Array.push, but only can take a single entrypop
: Just like Array.pop. Note: if you're only using push and pop,
then you have a stack, and Arrays are better for that.shift
: Just like Array.shift. Note: if you're only using push and
shift, then you have a queue, and Arrays are better for that.unshift
: Just like Array.unshift, but only can take a single entry.drop
: Drop all entriesitem(n)
: Retrieve the nth item in the list. This involves a walk
every time. It's very slow. If you find yourself using this,
consider using a normal Array instead.map(fn, thisp)
: Like Array.prototype.map
. Returns a new FastList.reduce(fn, startValue, thisp)
: Like Array.prototype.reduce
forEach(fn, this)
: Like Array.prototype.forEach
filter(fn, thisp)
: Like Array.prototype.filter
. Returns a new
FastList.slice(start, end)
: Retrieve an array of the items at this position.
This involves a walk every time. It's very slow. If you find
yourself using this, consider using a normal Array instead.length
: The number of things in the list. Note that, unlike
Array.length, this is not a getter/setter, but rather a counter that
is internally managed. Setting it can only cause harm.FAQs
A fast linked list (good for queues, stacks, etc.)
The npm package fast-list receives a total of 11,065 weekly downloads. As such, fast-list popularity was classified as popular.
We found that fast-list 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.