@identity-js/identity 1.3.0 → 1.4.0
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/.github/workflows/lint.yml +20 -0
- package/.github/workflows/smoke.yml +10 -0
- package/BUG-HISTORY.md +2 -3
- package/README.md +57 -57
- package/eslint.config.mjs +3 -0
- package/index.js +1643 -1
- package/package.json +582 -74
- package/test/enterprise.js +74 -0
- package/test/mocha.js +2262 -0
- package/lib/core.js +0 -83
- package/lib/coremeta2.js +0 -14
- package/lib/index.js +0 -1
- package/lib/meta2.js +0 -3
- package/lib/meta2IdentityFunctions.js +0 -25
- package/lib/meta2IdentityFunctionsUnstable.js +0 -3
- package/lib/meta2Unstable.js +0 -3
- package/lib/primitive.js +0 -10
- package/lib/syncResolve.js +0 -8
- package/lib/unstable.js +0 -1
- package/test/index.js +0 -192
- package/unstable.d.ts +0 -3
- package/unstable.js +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: 10xly Code Quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["**"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["**"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality-check:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
|
+
with:
|
|
16
|
+
node-version: "25"
|
|
17
|
+
- name: Install
|
|
18
|
+
run: npm install
|
|
19
|
+
- name: Run 10xly Lint
|
|
20
|
+
run: npx eslint . --max-warnings 0
|
package/BUG-HISTORY.md
CHANGED
|
@@ -30,9 +30,8 @@
|
|
|
30
30
|
// however a sanity check has already been implemented in vRetriever, and vValue
|
|
31
31
|
// has been removed in Identity.js. So this should never happen, but due to recent bugs
|
|
32
32
|
// and AI not making comprehensive enough tests, there is a slim chance that this could
|
|
33
|
-
// still happen.
|
|
34
|
-
//
|
|
35
|
-
// enough tests.
|
|
33
|
+
// still happen. Our moral of the story is that AI sometimes doesn't write good enough
|
|
34
|
+
// tests.
|
|
36
35
|
//
|
|
37
36
|
// For more information, see these commits:
|
|
38
37
|
//
|
package/README.md
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
# `@identity-js/identity`
|
|
2
|
-
|
|
3
|
-
Introducing Identity.js, the 10x identity function.
|
|
4
|
-
|
|
5
|
-
The identity function, $I(x)$, is a mathematical function that always returns the same value that was used as its argument, i.e., $I(x) = x$. This utility is often used in functional programming paradigms.
|
|
6
|
-
|
|
7
|
-
At 10x'ly made, we are always looking for new opportunities to make 10x libraries and then it struck us: what about an identity function? This package spreads **10x'ness** into the simple concept of an identity function. It's not just an identity function, it's a **10x identity function**.
|
|
8
|
-
|
|
9
|
-
## 💾 Installation
|
|
10
|
-
|
|
11
|
-
This project is a standard Node.js module.
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @identity-js/identity
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## 🚀 Usage
|
|
18
|
-
|
|
19
|
-
The function accepts a single argument of any type and returns that argument unchanged.
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
const identity = require("@identity-js/identity")
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Identity.js also has an unstable version that uses deasyncing `Promise.resolve`. It is called unstable because this is a weird hack. You can use it instead if you want:
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
const identity = require("@identity-js/identity/unstable")
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Then you can just call it with a value and it will return that value:
|
|
32
|
-
```javascript
|
|
33
|
-
const identity = require("@identity-js/identity")
|
|
34
|
-
|
|
35
|
-
console.log(identity("hello world")) // "hello world"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## ✅ Testing
|
|
39
|
-
|
|
40
|
-
Tests are written using **Mocha**.
|
|
41
|
-
|
|
42
|
-
### Prerequisites
|
|
43
|
-
Clone this repository
|
|
44
|
-
|
|
45
|
-
### Running Tests
|
|
46
|
-
|
|
47
|
-
Execute the test suite:
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
npm test
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
This will execute the tests to ensure the function works correctly across various data types (numbers, strings, objects, booleans, `null`, and `undefined`).
|
|
54
|
-
|
|
55
|
-
## ✍️ License
|
|
56
|
-
|
|
57
|
-
This project is licensed under the Unlicense.
|
|
1
|
+
# `@identity-js/identity`
|
|
2
|
+
|
|
3
|
+
Introducing Identity.js, the 10x identity function.
|
|
4
|
+
|
|
5
|
+
The identity function, $I(x)$, is a mathematical function that always returns the same value that was used as its argument, i.e., $I(x) = x$. This utility is often used in functional programming paradigms.
|
|
6
|
+
|
|
7
|
+
At 10x'ly made, we are always looking for new opportunities to make 10x libraries and then it struck us: what about an identity function? This package spreads **10x'ness** into the simple concept of an identity function. It's not just an identity function, it's a **10x identity function**.
|
|
8
|
+
|
|
9
|
+
## 💾 Installation
|
|
10
|
+
|
|
11
|
+
This project is a standard Node.js module.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @identity-js/identity
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 🚀 Usage
|
|
18
|
+
|
|
19
|
+
The function accepts a single argument of any type and returns that argument unchanged.
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
const identity = require("@identity-js/identity")
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Identity.js also has an unstable version that uses deasyncing `Promise.resolve`. It is called unstable because this is a weird hack. You can use it instead if you want:
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const identity = require("@identity-js/identity/unstable")
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then you can just call it with a value and it will return that value:
|
|
32
|
+
```javascript
|
|
33
|
+
const identity = require("@identity-js/identity")
|
|
34
|
+
|
|
35
|
+
console.log(identity("hello world")) // "hello world"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## ✅ Testing
|
|
39
|
+
|
|
40
|
+
Tests are written using **Mocha**.
|
|
41
|
+
|
|
42
|
+
### Prerequisites
|
|
43
|
+
Clone this repository and install dependencies and dev-dependencies.
|
|
44
|
+
|
|
45
|
+
### Running Tests
|
|
46
|
+
|
|
47
|
+
Execute the test suite:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
npm test
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This will execute the tests to ensure the function works correctly across various data types (numbers, strings, objects, booleans, `null`, and `undefined`).
|
|
54
|
+
|
|
55
|
+
## ✍️ License
|
|
56
|
+
|
|
57
|
+
This project is licensed under the Unlicense.
|