Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@blakeembrey/deque
Advanced tools
Deques are a generalization of stacks and queues (the name is pronounced "deck" and is short for "double-ended queue"). -- Python
collections
.
npm install @blakeembrey/deque --save
size
Returns the number of elements in the deque.push(x)
Add x
to right side of the deque.pushLeft(x)
Add x
to the left side of the deque.clear()
Remove all elements from the deque leaving it with length 0.extend(iterable)
Extend the right side of the deque by appending elements from iterable.extendLeft(iterable)
Extend the left side of the deque by appending elements from iterable.peek(i)
Return the element at index i
in the deque.indexOf(x, start?)
Return the position of x
in the deque.has(x)
Return a boolean indicating whether x
is in the deque.insert(i, x)
Insert x
into the deque at position i
.pop()
Remove and return an element from the right side of the deque. If no elements are present, throws RangeError
.popLeft()
Return and return an element from the left side of the deque. If no elements are present, throws RangeError
.delete(i)
Delete the value at position i
.reverse()
Reverse the elements of the deque in-place.rotate(n=1)
Rotate the deque n
steps to the right.entries()
Return an iterable of deque.@@iterator()
Return an iterable of deque.import { Deque } from '@blakeembrey/deque'
const d = new Deque('ghi')
for (const value of d) {
console.log(value.toUpperCase()) //=> G H I
}
d.push('j')
d.pushLeft('f')
d //=> Deque(['f', 'g', 'h', 'i', 'j'])
d.pop() //=> 'j'
d.popLeft() //=> 'f'
Array.from(d) //=> ['g', 'h', 'i']
d.peek(0) //=> 'g'
d.peek(-1) //=> 'i'
d.extend('jkl')
d //=> Deque(['g', 'h', 'i', 'j', 'k', 'l'])
d.rotate(1)
d //=> Deque(['l', 'g', 'h', 'i', 'j', 'k'])
d.rotate(-1)
d //=> Deque(['g', 'h', 'i', 'j', 'k', 'l'])
const d2 = new Deque(d)
d2 //=> Deque(['g', 'h', 'i', 'j', 'k', 'l'])
This project uses TypeScript and publishes definitions on NPM.
Circular array implementation originally based on denque
with additional optimizations.
Apache 2.0
FAQs
Deques are a generalization of stacks and queues
The npm package @blakeembrey/deque receives a total of 188,791 weekly downloads. As such, @blakeembrey/deque popularity was classified as popular.
We found that @blakeembrey/deque 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.