1.0.3 • Published 12 months ago

@uxland/ramda-extensions v1.0.3

Weekly downloads
-
License
BSD-4-Clause
Repository
github
Last release
12 months ago

UXL Ramda Extensions npm version

Build StatusStatementsBranchesFunctionsLines
BuildStatusStatementsBranchesFunctionsLines

Installation

npm i @uxland/ramda-extensions

Usage

Id equality

Checks if input value is equal to object's id

idEq("id")({ id: "id" }); //=> true
idEq("foo")({ id: "id" }); //=> false
idEq(undefined)({ foo: "bar" }); //=> true

Id

Returns property 'id' of object

id({ id: 1 }); //=> 1
id({ foo: "bar" }); //=> undefined

Is not empty

Checks whether input is empty

isNotEmpty(undefined); //=> true
isNotEmpty(1); //=> true
isNotEmpty("1"); //=> true
isNotEmpty(""); //=> false
isNotEmpty([]); //=> false
isNotEmpty(["foo"]); //=> true
isNotEmpty({}); //=> false
isNotEmpty({ foo: "bar" }); //=> true

Is not null neither empty

Checks whether input is not null nor empty

isNotNullNeitherEmpty(undefined); //=> false
isNotNullNeitherEmpty(1); //=> true
isNotNullNeitherEmpty("1"); //=> true
isNotNullNeitherEmpty(""); //=> false
isNotNullNeitherEmpty([]); //=> false
isNotNullNeitherEmpty(["foo"]); //=> true
isNotNullNeitherEmpty({}); //=> false
isNotNullNeitherEmpty({ foo: "bar" }); //=> true

Is not nil

Checks whether input is undefined or null

isNotNil(undefined); //=> false
isNotNil(1); //=> true
isNotNil("1"); //=> true
isNotNil(""); //=> true
isNotNil([]); //=> true
isNotNil(["foo"]); //=> true
isNotNil({}); //=> true
isNotNil({ foo: "bar" }); //=> true

Is null or empty

Checks whether input is null or empty

isNullOrEmpty(undefined); //=> true
isNullOrEmpty(1); //=> true
isNullOrEmpty("1"); //=> true
isNullOrEmpty(""); //=> true
isNullOrEmpty([]); //=> true
isNullOrEmpty(["foo"]); //=> true
isNullOrEmpty({}); //=> true
isNullOrEmpty({ foo: "bar" }); //=> true

Promise.all

Resolves Promise.all

Reject empty

Filters out input of empty values/items

rejectEmpty([]); //=> []
rejectEmpty(["foo", "", {}, { foo: "bar" }, undefined]); //=> [foo,{"foo":"bar"}, undefined]
rejectEmpty({}); //=> {}
rejectEmpty({ foo: "bar", qux: "", quux: undefined }); //=> {foo: 'bar'}

Reject nil or empty

Filters out input of empty or null values/items

rejectEmpty([]); //=> []
rejectEmpty(["foo", "", {}, { foo: "bar" }, undefined]); //=> foo,{"foo":"bar"}
rejectEmpty({}); //=> {}
rejectEmpty({ foo: "bar", qux: "", quux: undefined }); //=> {foo: 'bar'}

Reject nil

Filters out input null or undefined values/items

rejectEmpty([]); //=> []
rejectEmpty(["foo", "", {}, { foo: "bar" }, undefined]); //=> [foo,'',{"foo":"bar"}]
rejectEmpty({}); //=> {}
rejectEmpty({ foo: "bar", qux: "", quux: undefined }); //=> {foo: 'bar', qux: ''}

Array to dictionary by key

Converts an array to dictionary using provided key as reference

toDictionaryBy("id")([
  { id: 1, description: "foo" },
  { id: 2, description: "bar" },
]); //=> {1: {id: 1, description: 'foo'}, 2: {id: 2, description: 'bar'}}

Array to dictionary

Converts an array to dictionary using ID as key

toDictionary([
  { id: 1, description: "foo" },
  { id: 2, description: "bar" },
]); //=> {1: {id: 1, description: 'foo'}, 2: {id: 2, description: 'bar'}}

Path to array

Splits path by '.' into a string array

toPath('foo.bar') => ['foo', 'bar']
toPath('3') => ['3']
1.0.2

12 months ago

1.0.3

12 months ago

1.0.1

2 years ago

1.0.1-alpha.22

2 years ago

1.0.1-alpha.21

2 years ago

1.0.1-alpha.20

3 years ago

1.0.1-alpha.15

3 years ago

1.0.1-alpha.14

3 years ago

1.0.1-alpha.13

3 years ago

1.0.1-alpha.19

3 years ago

1.0.1-alpha.18

3 years ago

1.0.1-alpha.17

3 years ago

1.0.1-alpha.16

3 years ago

1.0.1-alpha.12

3 years ago

1.0.1-alpha.11

3 years ago

1.0.1-alpha.9

3 years ago

1.0.1-alpha.8

3 years ago

1.0.1-alpha.10

3 years ago

1.0.1-alpha.7

3 years ago

1.0.1-alpha.6

3 years ago

1.0.1-alpha.5

3 years ago

1.0.1-alpha.4

3 years ago

1.0.1-alpha.3

3 years ago

1.0.1-alpha.2

3 years ago

1.0.1-alpha.1

3 years ago

1.0.1-alpha.0

3 years ago

1.0.0

3 years ago

1.0.0-alpha.3

3 years ago

1.0.0-alpha.2

3 years ago

1.0.0-alpha.1

3 years ago

1.0.0-alpha.0

3 years ago