@identity-js/identity 1.0.0 → 1.2.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/README.md CHANGED
@@ -38,11 +38,11 @@ const identity = require("@identity-js/identity");
38
38
  Tests are written using **Mocha**.
39
39
 
40
40
  ### Prerequisites
41
- Clone this repository and install dependencies and dev-dependencies.
41
+ Clone this repository, cd into `packages/identity` and install dependencies and dev-dependencies.
42
42
 
43
43
  ### Running Tests
44
44
 
45
- Execute the test suite :
45
+ Execute the test suite:
46
46
 
47
47
  ```
48
48
  npm test
package/index.js CHANGED
@@ -9,11 +9,13 @@ var immo = require("@_immo/return")
9
9
  var isuseless = require("is-useless").isuseless
10
10
  var falsevalue = require("false-value")()
11
11
  var identityfunction = require("identity-function")
12
+ var isFinite = require("@is-(unknown)/is-finite")
13
+ var isString = require("@is-(unknown)/is-string")
12
14
 
13
15
  function identityCore(value) {
14
- if (typeof value === "string") {
16
+ if (isString(value)) {
15
17
  return stringIdentity(value)
16
- } else if (typeof value === "number" || Number.isFinite(value)) {
18
+ } else if (isFinite(value)) {
17
19
  var result = numberIdentity(value)
18
20
  if (result === 0 && value !== 0) {
19
21
  return value
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@identity-js/identity",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Returns the value passed into the function.",
5
5
  "keywords": [
6
6
  "identity-js"
7
7
  ],
8
- "homepage": "https://github.com/10xEngineersQualityProgramming/identity#readme",
8
+ "homepage": "https://github.com/enterprise-npm-ai/identityjs#readme",
9
9
  "bugs": {
10
- "url": "https://github.com/10xEngineersQualityProgramming/identity/issues"
10
+ "url": "https://github.com/enterprise-npm-ai/identityjs/issues"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git+https://github.com/10xEngineersQualityProgramming/identity.git"
14
+ "url": "git+https://github.com/enterprise-npm-ai/identityjs.git"
15
15
  },
16
16
  "license": "Unlicense",
17
17
  "author": "me",
@@ -23,15 +23,17 @@
23
23
  "dependencies": {
24
24
  "@_immo/return": "^1.1.1",
25
25
  "@f/identity": "^1.1.1",
26
- "@identity-js/number-identity": "^1.1.0",
26
+ "@identity-js/number-identity": "^1.2.0",
27
27
  "@identity-js/string-identity": "^1.1.0",
28
+ "@is-(unknown)/is-finite": "^1.0.0",
29
+ "@is-(unknown)/is-string": "^1.0.0",
28
30
  "@stdlib/utils-identity-function": "^0.2.2",
29
31
  "false-value": "^2.0.1",
30
32
  "identity-function": "^1.0.0",
31
33
  "is-useless": "^1.3.4",
32
34
  "lodash.identity": "^3.0.0",
33
- "vretriever": "^1.0.1",
34
- "vvalue": "^1.0.0"
35
+ "vretriever": "^1.1.0",
36
+ "vvalue": "^1.1.0"
35
37
  },
36
38
  "devDependencies": {
37
39
  "chai": "^6.2.1",
package/test/index.js CHANGED
@@ -34,4 +34,14 @@ describe('identity()', () => {
34
34
  const input = undefined
35
35
  assert.strictEqual(identity(input), undefined, 'The function should return undefined.')
36
36
  })
37
+
38
+ it('should return NaN when NaN is passed in', () => {
39
+ const input = NaN
40
+ assert.isNaN(identity(input), "The function should return NaN")
41
+ })
42
+
43
+ it('should return Infinity when Infinity is passed in', () => {
44
+ const input = Infinity
45
+ assert.strictEqual(identity(input), Infinity, "The function should return infinity")
46
+ })
37
47
  })