@cuser/utils

0.0.36 • Public • Published

cuser logo

Status

codecov npm npm-downloads

@cuser/utils

Index

Functions

Functions

assert

Constassert(assertion: any, ...args: any[]): void

Defined in assert.js:12

Asserts a condition to raise an error when not fullfilled

example

assert(true, 'should not raise the custom error with args %s', 'foo');
assert(false, 'should raise the custom error with args %s', 'foo');

Parameters:

Name Type
assertion any
...args any[]

Returns: void


formatErr

ConstformatErr(...args: any[]): Error

Defined in formatErr.js:12

Formats an error like sprintf

example

formatErr('messsage error with argument %s', 'foo')
formatErr(TypeError, 'messsage error with argument %s and custom Error constructor', 'foo')

Parameters:

Name Type
...args any[]

Returns: Error


timestamp

Consttimestamp(): number

Defined in timestamp.js:5

Gets current timestamp

Returns: number

/@cuser/utils/

    Package Sidebar

    Install

    npm i @cuser/utils

    Weekly Downloads

    12

    Version

    0.0.36

    License

    MIT

    Unpacked Size

    6.64 kB

    Total Files

    14

    Last publish

    Collaborators

    • rubeniskov