2.2.5 • Published 3 years ago

extra-object.min v2.2.5

Weekly downloads
71
License
MIT
Repository
github
Last release
3 years ago

An object is a collection of properties, with associated values. :running: :package: :ledger:

Methods as separate packages:

Methods look like:

  • swap(): doesn't modify the object itself (pure).
  • swap$(): modifies the object itself (update).

In the future when you think of just giving up on life, remember that the letter was in your hands, the cab was at the gate, only if you had thought about it once more, your entire life would have been better. (1)

Stability: Experimental. This is browserified, minified version of extra-object. It is exported as global variable object. CDN: unpkg, jsDelivr.

const object = require('extra-object');
// import * as object from 'extra-object';
// import * as object from 'https://unpkg.com/extra-object@2.1.0/index.mjs'; (deno)

var x = {a: 1, b: 2, c: 3, d: 4};
object.swap(x, 'a', 'b');
// { a: 2, b: 1, c: 3, d: 4 }

var x = {a: 1, b: 2, c: 3, d: 4};
var y = {b: 20, c: 30, e: 50};
object.intersection(x, y);
// { b: 2, c: 3 }

var x = {a: 1, b: 2, c: 3, d: -2};
object.searchAll(x, v => Math.abs(v) === 2);
// [ 'b', 'd' ]

var x = {a: 1, b: 2, c: 3};
[...object.subsets(x)];
// [
//   {},
//   { a: 1 },
//   { b: 2 },
//   { a: 1, b: 2 },
//   { c: 3 },
//   { a: 1, c: 3 },
//   { b: 2, c: 3 },
//   { a: 1, b: 2, c: 3 }
// ]

reference

MethodAction
isChecks if value is object.
getGets value at key.
setSets value at key.
removeDeletes an entry.
swapExchanges two values.
sizeGets size of object.
headGets first entry.
takeKeeps first n entries only.
shiftRemoves first entry.
fromEntriesCreates object from entries.
concatCombines entries from objects, preferring last.
flatFlattens nested object to given depth.
chunkBreaks object into chunks of given size.
filterAtGets object with given keys.
mapUpdates values based on map function.
filterKeeps entries which pass a test.
reduceReduces values to a single value.
rangeFinds smallest and largest entries.
countCounts values which satisfy a test.
partitionSegregates values by test result.
cartesianProductLists cartesian product of objects.
someChecks if any value satisfies a test.
zipCombines entries from objects.
unionGives entries present in any object.
intersectionGives entries present in both objects.
differenceGives entries of object not present in another.
symmetricDifferenceGives entries not present in both objects.
isDisjointChecks if objects have no common keys.
keyPicks an arbitrary key.
valuePicks an arbitrary value.
entryPicks an arbitrary entry.
subsetPicks an arbitrary subset.
isEmptyChecks if object is empty.
isEqualChecks if two objects are equal.
compareCompares two objects.
findFinds value of an entry passing a test.
searchFinds key of an entry passing a test.
scanWhileFinds key of first entry not passing a test.

nodef

2.2.5

3 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.1

4 years ago

2.2.2

4 years ago

2.1.21

4 years ago

2.1.20

4 years ago

2.1.18

4 years ago

2.1.15

4 years ago

2.1.14

4 years ago

2.1.11

4 years ago

2.1.10

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.3

4 years ago

2.1.5

4 years ago

2.1.0

4 years ago

2.0.142

4 years ago

2.0.138

4 years ago

2.0.137

4 years ago

2.0.131

4 years ago

2.0.130

4 years ago

2.0.128

4 years ago

2.0.124

4 years ago

2.0.122

4 years ago

2.0.118

4 years ago

2.0.117

4 years ago

2.0.116

4 years ago

2.0.115

4 years ago

2.0.112

4 years ago

2.0.111

4 years ago

2.0.108

4 years ago

2.0.107

4 years ago

2.0.98

4 years ago

2.0.93

4 years ago

2.0.106

4 years ago

2.0.105

4 years ago

2.0.104

4 years ago

2.0.103

4 years ago

2.0.102

4 years ago

2.0.101

4 years ago

2.0.100

4 years ago

2.0.77

4 years ago

2.0.75

4 years ago

2.0.76

4 years ago

2.0.74

4 years ago

2.0.71

4 years ago

2.0.91

4 years ago

2.0.70

4 years ago

2.0.90

4 years ago

2.0.69

4 years ago

2.0.66

4 years ago

2.0.67

4 years ago

2.0.64

4 years ago

2.0.87

4 years ago

2.0.65

4 years ago

2.0.82

4 years ago

2.0.83

4 years ago

2.0.80

4 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago