@x-oasis/is 0.1.20

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 ADDED
@@ -0,0 +1,19 @@
1
+ # @x-oasis/is
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ $ npm i @x-oasis/is
7
+ ```
8
+
9
+ ## How to use
10
+
11
+ ```typescript
12
+ import is from '@x-oasis/is'
13
+ ```
14
+
15
+ ## How to run test
16
+
17
+ ```bash
18
+ $ pnpm test
19
+ ```
@@ -0,0 +1,2 @@
1
+ declare const _default: (x: any, y: any) => boolean;
2
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./is.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./is.cjs.development.js')
8
+ }
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var index = (function (x, y) {
6
+ if (x === y) {
7
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
8
+ }
9
+ return x !== x && y !== y;
10
+ });
11
+
12
+ exports.default = index;
13
+ //# sourceMappingURL=is.cjs.development.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nexport default (x: any, y: any) => {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n }\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n};\n"],"names":["x","y"],"mappings":";;;;AAIA,aAAe,UAACA,CAAM,EAAEC,CAAM;EAE5B,IAAID,CAAC,KAAKC,CAAC,EAAE;IAIX,OAAOD,CAAC,KAAK,CAAC,IAAIC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAGD,CAAC,KAAK,CAAC,GAAGC,CAAC;;EAG9C,OAAOD,CAAC,KAAKA,CAAC,IAAIC,CAAC,KAAKA,CAAC;AAC3B,CAAC;;;;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t};
2
+ //# sourceMappingURL=is.cjs.production.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nexport default (x: any, y: any) => {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n }\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n};\n"],"names":["x","y"],"mappings":"6FAIgBA,EAAQC,GAEtB,OAAID,IAAMC,EAIK,IAAND,GAAiB,IAANC,GAAW,EAAID,GAAM,EAAIC,EAGtCD,GAAMA,GAAKC,GAAMA"}
package/dist/is.esm.js ADDED
@@ -0,0 +1,9 @@
1
+ var index = (function (x, y) {
2
+ if (x === y) {
3
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
4
+ }
5
+ return x !== x && y !== y;
6
+ });
7
+
8
+ export default index;
9
+ //# sourceMappingURL=is.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is.esm.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nexport default (x: any, y: any) => {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n }\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n};\n"],"names":["x","y"],"mappings":"AAIA,aAAe,UAACA,CAAM,EAAEC,CAAM;EAE5B,IAAID,CAAC,KAAKC,CAAC,EAAE;IAIX,OAAOD,CAAC,KAAK,CAAC,IAAIC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAGD,CAAC,KAAK,CAAC,GAAGC,CAAC;;EAG9C,OAAOD,CAAC,KAAKA,CAAC,IAAIC,CAAC,KAAKA,CAAC;AAC3B,CAAC;;;;"}
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@x-oasis/is",
3
+ "version": "0.1.20",
4
+ "description": "is function",
5
+ "main": "dist/index.js",
6
+ "typings": "dist/index.d.ts",
7
+ "module": "dist/is.esm.js",
8
+ "author": "",
9
+ "license": "ISC",
10
+ "devDependencies": {
11
+ "tsdx": "^0.14.1"
12
+ },
13
+ "dependencies": {},
14
+ "scripts": {
15
+ "build": "tsdx build --tsconfig tsconfig.build.json",
16
+ "clean": "rimraf ./dist",
17
+ "test": "vitest",
18
+ "compile": "tsc -p tsconfig.build.json"
19
+ }
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
3
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
4
+ */
5
+ export default (x: any, y: any) => {
6
+ // SameValue algorithm
7
+ if (x === y) {
8
+ // Steps 1-5, 7-10
9
+ // Steps 6.b-6.e: +0 != -0
10
+ // Added the nonzero y check to make Flow happy, but it is redundant
11
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
12
+ }
13
+ // Step 6.a: NaN == NaN
14
+ return x !== x && y !== y;
15
+ };
@@ -0,0 +1,7 @@
1
+ import { expect, test } from 'vitest';
2
+ import is from '../src';
3
+
4
+ test('vitest', async () => {
5
+ expect(is(1, 1)).toBe(true);
6
+ expect(is(NaN, NaN)).toBe(true);
7
+ });
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../../tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "esModuleInterop": true
6
+ },
7
+
8
+ "include": [
9
+ "src/**/*"
10
+ ]
11
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "jsx": "react",
5
+ "esModuleInterop": true
6
+ }
7
+ }