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.
@daeinc/array
Advanced tools
Array utilities.
npm i @daeinc/array
then,
import { fillAndMap, ... } from "@daeinc/array";
const accumulate: (arr: number[], precision?: number) => number[];
Takes in a number array and returns a new array with values accumulated. For example, the input array [1, 2, 3, 4]
will return [1, 3, 6, 10]
. It also takes an optional parameter precision
(default=4) to compensate for float rounding error. The original values are used while summing, but the return values will be rounded.
const addToArray: <T>(
arr: T[],
entry: T,
newArrayLen: number,
mode?: "first" | "last"
) => T[];
Adds a new element to array in-place while limiting how many to keep history. The mode first
will insert at the beginning of the array.
const fillAndMap: <T>(n: number, fn: (el: null, idx: number) => T) => T[];
Creates a new array with given length and maps values
const getNonZeroIndices: (arr: number[]) => number[];
Check for elements with non-zero values and return indices.
const interpolateArray: (
arrStart: number[],
arrTarget: number[],
t: number
) => number[];
Interpolates between two 1-dimensional arrays of same size.
const isAllOne: (arr: number[]) => boolean;
Returns true
if all elements of input array is 1
.
const isAllZero: (arr: number[]) => boolean;
Returns true
if all elements of input array is 0
.
const isAnyOne: (arr: number[]) => boolean;
Returns true
if any element of input array is 1
.
const isAnyZero: (arr: number[]) => boolean;
Returns true
if any element of input array is 0
.
const unwrapArrayOfObjects: (
arr: {
[key: string]: any;
}[],
objKey: string
) => any[];
A helper function to get object values inside an array. All objects must have same keys present. For example, when the input array is [ {name: val1}, {name: val2} ]
, calling unwrapArrayOfObjects(arr, "name")
will return [val1, val2]
.
MIT
FAQs
Array utilities
The npm package @daeinc/array receives a total of 105 weekly downloads. As such, @daeinc/array popularity was classified as not popular.
We found that @daeinc/array 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.