@identity-js/identity 1.2.8 → 1.2.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/index.js CHANGED
@@ -28,6 +28,9 @@ function identityCore(value) {
28
28
  }
29
29
 
30
30
  function identity(value) {
31
+ if (Object.is(value, -0)) {
32
+ return -0
33
+ }
31
34
  if (value === null || value === undefined) {
32
35
  return value
33
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@identity-js/identity",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Returns the value passed into the function.",
5
5
  "keywords": [
6
6
  "identity-js"
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@f/identity": "^1.1.1",
25
- "@identity-js/number-identity": "^1.2.2",
25
+ "@identity-js/number-identity": "^1.2.3",
26
26
  "@identity-js/string-identity": "^1.1.3",
27
27
  "@is-(unknown)/is-finite": "^1.0.0",
28
28
  "@is-(unknown)/is-string": "^1.0.0",
package/test/index.js CHANGED
@@ -12,6 +12,18 @@ describe('identity()', () => {
12
12
  const input = 3.2
13
13
  assert.strictEqual(identity(input), 3.2, "The function should return 3.2")
14
14
  })
15
+
16
+ it('should return the same negative number that was passed in', () => {
17
+ const input = -5
18
+ assert.strictEqual(identity(input), -5, 'The function should return the number -5.')
19
+ })
20
+
21
+ it('should return -0 when -0 is passed in', () => {
22
+ const input = -0
23
+ const result = identity(input)
24
+ assert.strictEqual(result, -0, 'The function should return -0.')
25
+ assert.isTrue(Object.is(result, -0), 'The function should return the exact value of -0.')
26
+ })
15
27
 
16
28
  it('should return the same string that was passed in', () => {
17
29
  const input = 'hello world'