Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@ircam/sc-utils
Advanced tools
Simple generic utilities (type check, common math functions, etc.)
npm install --save @ircam/sc-utils
boolean
Check if the platform is a browser or a node process
Promise
Waits for given number of milliseconds
Promise
Same of delay
, but given argument is in seconds
boolean
Check if the value is a string
boolean
Check if the value is a function
boolean
Check if the value is a number, including Infinity. If you want to excluse Infinity, check the native Number.isFinite function
boolean
Check if the value is a Plain Old Javascript Object (POJO)
boolean
Check if the value is a TypedArray
number
Convert a dB into linear gain (i.e. gain) Alias: decibelToLinear
number
Convert a dB into linear gain (i.e. gain) Alis: dbtoa
number
Convert a dB into power gain
number
Convert a linear gain into dB Alias: linearToDecibel
number
Convert a linear gain into dB Alias: atodb
number
Convert a linear gain into dB
number
Convert a MIDI note to frequency
number
Convert a frequency to a MIDI note
function
Create a scale function
Iterator
Create a iterator of incrementing ids
boolean
Check if the platform is a browser or a node process
Kind: global constant
Example
import { isBrowser } from '@ircam/sc-utils';
isBrowser();
// > true|false
Promise
Waits for given number of milliseconds
Kind: global function
Param | Type | Description |
---|---|---|
ms | Number | Number of milliseconds to wait |
Example
import { delay } from '@ircam/sc-utils';
// wait for 1 second
await delay(1000);
Promise
Same of delay
, but given argument is in seconds
Kind: global function
Param | Type | Description |
---|---|---|
sec | Number | Number of seconds to wait |
Example
import { sleep } from '@ircam/sc-utils';
// wait for 1 second
await sleep(1);
boolean
Check if the value is a string
Kind: global function
Param | Type | Description |
---|---|---|
val | * | Value to check |
Example
import { isString } from '@ircam/sc-utils';
isString('test');
// > true
boolean
Check if the value is a function
Kind: global function
Param | Type | Description |
---|---|---|
val | * | Value to check |
Example
import { isFunction } from '@ircam/sc-utils';
isFunction(() => {}));
// > true
boolean
Check if the value is a number, including Infinity. If you want to excluse Infinity, check the native Number.isFinite function
Kind: global function
Param | Type | Description |
---|---|---|
val | * | Value to check |
Example
import { isNumber } from '@ircam/sc-utils';
isNumber(42);
// > true
boolean
Check if the value is a Plain Old Javascript Object (POJO)
Kind: global function
Param | Type | Description |
---|---|---|
val | * | Value to check |
Example
import { isObject } from '@ircam/sc-utils';
isObject({ a: 1 });
// > true
boolean
Check if the value is a TypedArray
Kind: global function
Param | Type | Description |
---|---|---|
val | * | Value to check |
Example
import { isTypedArray } from '@ircam/sc-utils';
isTypedArray(new Float32Array([1, 2, 3]));
// > true
number
Convert a dB into linear gain (i.e. gain) Alias: decibelToLinear
Kind: global function
Param | Type | Description |
---|---|---|
val | number | Value to convert |
Example
import { dbtoa } from '@ircam/sc-utils';
dbtoa(0);
// > 1
number
Convert a dB into linear gain (i.e. gain) Alis: dbtoa
Kind: global function
Param | Type | Description |
---|---|---|
val | number | Value to convert |
Example
import { decibelToLinear } from '@ircam/sc-utils';
decibelToLinear(0);
// > 1
number
Convert a dB into power gain
Kind: global function
Param | Type | Description |
---|---|---|
val | number | Value to convert |
Example
import { decibelToPower } from '@ircam/sc-utils';
decibelToPower(0);
// > 1
number
Convert a linear gain into dB Alias: linearToDecibel
Kind: global function
Param | Type | Description |
---|---|---|
val | number | Value to convert |
Example
import { atodb } from '@ircam/sc-utils';
atodb(0);
// > 1
number
Convert a linear gain into dB Alias: atodb
Kind: global function
Param | Type | Description |
---|---|---|
val | number | Value to convert |
Example
import { decibelToPower } from '@ircam/sc-utils';
decibelToPower(0);
// > 1
number
Convert a linear gain into dB
Kind: global function
Param | Type | Description |
---|---|---|
val | number | Value to convert |
Example
import { decibelToPower } from '@ircam/sc-utils';
decibelToPower(0);
// > 1
number
Convert a MIDI note to frequency
Kind: global function
Param | Type | Description |
---|---|---|
midiNote | number | MIDI Note to convert |
Example
import { mtof } from '@ircam/sc-utils';
const freq = mtof(69);
// > 440
number
Convert a frequency to a MIDI note
Kind: global function
Param | Type | Description |
---|---|---|
freq | number | Frequency to convert |
Example
import { ftom } from '@ircam/sc-utils';
const freq = ftom(440);
// > 69
function
Create a scale function
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
minIn | number | Minimum input | |
maxIn | number | Maximum input | |
minOut | number | Minimum output | |
maxOut | number | Maximum output | |
[clamp] | boolean | false | Clamp output |
Example
import { scale } from '@ircam/sc-utils';
const myScale = scale(0, 1, 50, 100);
myScale(0.5);
// > 75
Iterator
Create a iterator of incrementing ids
Kind: global function
Example
import { idGenerator } from '@ircam/sc-utils';
const generator = idGenerator();
const id = generator.next().value
FAQs
Set of simple generic utilities (type check, common math functions, etc.)
The npm package @ircam/sc-utils receives a total of 157 weekly downloads. As such, @ircam/sc-utils popularity was classified as not popular.
We found that @ircam/sc-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.