lolite.first 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,48 @@
1
- # lolite.first
2
-
3
- ### first(array)
1
+ ## first(array)
4
2
  alias: head(array)
5
3
 
6
4
  Get the first element of an array. Returns undefined for non-arrays.
7
5
  ```javascript
8
- const first = require("lolite.first")
6
+ const lolite = require("lolite.first")
9
7
  const testArray = [0, 1, 2]
10
8
  console.log(first(testArray)) // 0
11
9
  console.log(lolite.head(testArray)) // 0
12
- ```
13
-
14
- This utility is part of the [LoLite](https://github.com/enterprise-npm-ai/lolite) utility suite.
10
+ ```
11
+
12
+ ### last(array)
13
+
14
+ Get the last element of an array. Returns undefined for non-arrays.
15
+ ```javascript
16
+ const lolite = require("lolite.first")
17
+ const testArray = [0, 1, 2]
18
+ console.log(lolite.last(testArray)) // 2
19
+ ```
20
+
21
+ ### initial(array)
22
+ Returns all but the last element of an array. Returns undefined for non-arrays.
23
+ ```js
24
+ const lolite = require("lolite.first")
25
+ const result = lolite.initial([1, 2, 3])
26
+ // result: [1, 2]
27
+
28
+ const single = lolite.initial([1])
29
+ // result: []
30
+
31
+ const undef = lolite.initial("Not an array")
32
+ // result: undefined
33
+ ```
34
+
35
+ ### tail(array)
36
+ Returns all but the first element of an array. Returns undefined for non-arrays.
37
+ ```js
38
+ const lolite = require("lolite.first")
39
+ const result = lolite.tail([1, 2, 3])
40
+ // result: [2, 3]
41
+
42
+ const single = lolite.tail([1])
43
+ // result: []
44
+
45
+ const undef = lolite.tail(null)
46
+ // result: undefined
47
+ ```
48
+
package/package.json CHANGED
@@ -1,34 +1,24 @@
1
1
  {
2
2
  "name": "lolite.first",
3
- "version": "1.1.7",
4
- "description": "Enterprise-grade first 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/first.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
7
  "@is-(unknown)/is-true": "^1.5.0",
8
+ "@is-(unknown)/is-false": "^1.5.0",
21
9
  "array-filter": "^1.0.0",
10
+ "true-value": "^2.0.5",
11
+ "false-value": "^2.0.6",
22
12
  "@is-(unknown)/is-array": "^1.0.0",
23
- "@10xly/strict-equals": "^1.0.0",
24
- "@identity-js/identity": "^1.2.1",
25
- "literally": "^1.0.0",
26
- "twice-call-wrapper": "^1.2.0",
27
- "yanoop": "^1.0.0",
28
- "@rightpad/concat": "^1.0.0",
29
- "capitalize": "^2.0.4",
13
+ "undefined-is-a-function": "^0.1.0",
30
14
  "functions-have-names": "^1.2.3",
15
+ "capitalize": "^2.0.4",
16
+ "@rightpad/concat": "^1.0.0",
31
17
  "to-str": "^1.0.0",
32
- "undefined-is-a-function": "^0.1.0"
18
+ "twice-call-wrapper": "^1.2.0",
19
+ "yanoop": "^1.0.0",
20
+ "@identity-js/identity": "^1.2.1",
21
+ "literally": "^1.0.0",
22
+ "@10xly/strict-equals": "^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) => {
@@ -0,0 +1,5 @@
1
+ const [TRUE] = require("../private/arrayOfAllBooleans")
2
+ const constant = require("./constant"),
3
+ stubTrue = constant(TRUE)
4
+
5
+ module.exports = stubTrue
package/stubTrue.js DELETED
@@ -1,5 +0,0 @@
1
- const [TRUE] = require("./arrayOfAllBooleans")
2
- const constant = require("./constant"),
3
- stubTrue = constant(TRUE)
4
-
5
- module.exports = stubTrue
File without changes
File without changes
File without changes
File without changes