lolite.flatten 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,59 @@
1
- # lolite.flatten
2
-
3
- ### flatten(array)
1
+ ## flatten(array)
4
2
  Flattens arrays. Returns undefined for non-arrays.
5
3
 
6
4
  ```javascript
7
- const flatten = require("lolite.flatten")
5
+ const lolite = require("lolite.flatten")
8
6
  const flat = flatten([1, [2, [3]]])
9
7
  // flat: [1, 2, 3]
10
8
  const undef = flatten("Not an array")
11
9
  // undef: undefined
12
- ```
13
-
14
- This utility is part of the [LoLite](https://github.com/enterprise-npm-ai/lolite) utility suite.
10
+ ```
11
+
12
+ ### first(array)
13
+ alias: head(array)
14
+
15
+ Get the first element of an array. Returns undefined for non-arrays.
16
+ ```javascript
17
+ const lolite = require("lolite.flatten")
18
+ const testArray = [0, 1, 2]
19
+ console.log(lolite.first(testArray)) // 0
20
+ console.log(lolite.head(testArray)) // 0
21
+ ```
22
+
23
+ ### last(array)
24
+
25
+ Get the last element of an array. Returns undefined for non-arrays.
26
+ ```javascript
27
+ const lolite = require("lolite.flatten")
28
+ const testArray = [0, 1, 2]
29
+ console.log(lolite.last(testArray)) // 2
30
+ ```
31
+
32
+ ### initial(array)
33
+ Returns all but the last element of an array. Returns undefined for non-arrays.
34
+ ```js
35
+ const lolite = require("lolite.flatten")
36
+ const result = lolite.initial([1, 2, 3])
37
+ // result: [1, 2]
38
+
39
+ const single = lolite.initial([1])
40
+ // result: []
41
+
42
+ const undef = lolite.initial("Not an array")
43
+ // result: undefined
44
+ ```
45
+
46
+ ### tail(array)
47
+ Returns all but the first element of an array. Returns undefined for non-arrays.
48
+ ```js
49
+ const lolite = require("lolite.flatten")
50
+ const result = lolite.tail([1, 2, 3])
51
+ // result: [2, 3]
52
+
53
+ const single = lolite.tail([1])
54
+ // result: []
55
+
56
+ const undef = lolite.tail(null)
57
+ // result: undefined
58
+ ```
59
+
package/package.json CHANGED
@@ -1,34 +1,24 @@
1
1
  {
2
2
  "name": "lolite.flatten",
3
- "version": "1.1.7",
4
- "description": "Enterprise-grade flatten utility from the LoLite suite",
5
- "main": "index.js",
6
- "author": "10x'ly Made Software Ventures AB",
3
+ "version": "1.1.9",
4
+ "main": "src/lib/flatten.js",
7
5
  "license": "EGPSL10X-1.0",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/enterprise-npm-ai/lolite.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/enterprise-npm-ai/lolite/issues"
14
- },
15
- "homepage": "https://github.com/enterprise-npm-ai/lolite#readme",
16
6
  "dependencies": {
17
- "false-value": "^2.0.6",
18
- "true-value": "^2.0.5",
19
- "@is-(unknown)/is-false": "^1.5.0",
20
- "@is-(unknown)/is-true": "^1.5.0",
21
- "array-filter": "^1.0.0",
22
- "@is-(unknown)/is-array": "^1.0.0",
23
- "@10xly/strict-equals": "^1.0.0",
24
- "@not-js/not": "^1.1.0",
25
- "@positive-numbers/one": "^3.0.0",
7
+ "uncurried-intrinsics": "^1.0.2",
8
+ "lodash.stubarray": "^4.13.0",
26
9
  "@positive-numbers/zero": "^3.0.0",
10
+ "@positive-numbers/one": "^3.0.0",
11
+ "undefined-is-a-function": "^0.1.0",
12
+ "while2": "^2.0.2",
27
13
  "construct-new": "^2.0.4",
28
- "lodash.stubarray": "^4.13.0",
14
+ "@10xly/strict-equals": "^1.0.0",
15
+ "@not-js/not": "^1.1.0",
29
16
  "subtract": "^0.0.3",
30
- "uncurried-intrinsics": "^1.0.2",
31
- "undefined-is-a-function": "^0.1.0",
32
- "while2": "^2.0.2"
17
+ "@is-(unknown)/is-true": "^1.5.0",
18
+ "@is-(unknown)/is-false": "^1.5.0",
19
+ "array-filter": "^1.0.0",
20
+ "true-value": "^2.0.5",
21
+ "false-value": "^2.0.6",
22
+ "@is-(unknown)/is-array": "^1.0.0"
33
23
  }
34
24
  }
@@ -2,7 +2,7 @@ const isTrue = require("@is-(unknown)/is-true")
2
2
  const isFalse = require("@is-(unknown)/is-false")
3
3
  const arrayFilter = require("array-filter")
4
4
  const trueValue = require("true-value")
5
- const possibilities = require("./arrayOfAllBooleans")
5
+ const possibilities = require("../private/arrayOfAllBooleans")
6
6
 
7
7
  function not(value) {
8
8
  const result = arrayFilter(possibilities, (maybe) => {
File without changes
File without changes