@uxland/utilities
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

UXL Utilities npm version

Build Status Statements Branches Functions Lines
BuildStatus Statements Branches Functions Lines

Installation

npm i @uxland/utilities

Usage

Collect

Returns nested object value and prototype from provided key.

collect("foo", "foo"); //=> {}
collect({ foo: "bar" }); //=> {0: 'b', 1: 'a', 2: 'r'}
collect({ foo: { bar: "qux" } }); //=> {bar: 'qux'}

Constant Builder

Converts a string to a new one with provided prefix and suffix in builder

constantBuilder("PREFIX")("CONSTANT"); //=> 'PREFIX:CONSTANT'
constantBuilder("PREFIX", "SUFFIX")("CONSTANT"); //=> 'PREFIX:CONSTANT:SUFFIX'
constantBuilder("PREFIX", "SUFFIX", "$$")("CONSTANT"); //=> 'PREFIX$$CONSTANT$$SUFFIX'

Invariant

Check if condition is fulfilled, otherwise throws supplied message error

invariant(R.is("number")(3), "Supplied value is not a number"); //=> undefined
invariant(R.is("number")("3"), "Supplied value is not a number"); //=> 'Supplied value is not a number'

No operation

Defines an empty function

nop(); //=> undefined

/@uxland/utilities/

    Package Sidebar

    Install

    npm i @uxland/utilities

    Weekly Downloads

    70

    Version

    1.0.5

    License

    BSD-4-Clause

    Unpacked Size

    253 kB

    Total Files

    20

    Last publish

    Collaborators

    • danielcabiscol
    • uxland-admin