@x-oasis/is-primitive-empty 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 +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/is-primitive-empty.cjs.development.js +10 -0
- package/dist/is-primitive-empty.cjs.development.js.map +1 -0
- package/dist/is-primitive-empty.cjs.production.min.js +2 -0
- package/dist/is-primitive-empty.cjs.production.min.js.map +1 -0
- package/dist/is-primitive-empty.esm.js +6 -0
- package/dist/is-primitive-empty.esm.js.map +1 -0
- package/package.json +20 -0
- package/src/index.ts +5 -0
- package/test/test.spec.ts +14 -0
- package/tsconfig.build.json +11 -0
- package/tsconfig.json +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @x-oasis/is-primitive-empty
|
|
2
|
+
|
|
3
|
+
_test if a variable is a `null` or `undefined`_
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
$ npm i @x-oasis/is-primitive-empty
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## How to use
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import isPrimitiveEmpty from '@x-oasis/is-primitive-empty'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## How to run test
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
$ pnpm test
|
|
21
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-primitive-empty.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["// https://stackoverflow.com/a/5515385\n\n// just like `return value === undefined || value === null;`\n\nexport default (val: any) => val == null;\n"],"names":["val"],"mappings":";;;;AAIA,aAAe,UAACA,GAAQ;EAAA,OAAKA,GAAG,IAAI,IAAI;AAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-primitive-empty.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["// https://stackoverflow.com/a/5515385\n\n// just like `return value === undefined || value === null;`\n\nexport default (val: any) => val == null;\n"],"names":["val"],"mappings":"6FAIgBA,GAAQ,OAAY,MAAPA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-primitive-empty.esm.js","sources":["../src/index.ts"],"sourcesContent":["// https://stackoverflow.com/a/5515385\n\n// just like `return value === undefined || value === null;`\n\nexport default (val: any) => val == null;\n"],"names":["val"],"mappings":"AAIA,aAAe,UAACA,GAAQ;EAAA,OAAKA,GAAG,IAAI,IAAI;AAAA;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x-oasis/is-primitive-empty",
|
|
3
|
+
"version": "0.1.20",
|
|
4
|
+
"description": "is-primitive-empty function",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"typings": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/is-primitive-empty.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,14 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import isPrimitiveEmpty from '../src';
|
|
3
|
+
|
|
4
|
+
test('vitest', async () => {
|
|
5
|
+
expect(isPrimitiveEmpty(1)).toBe(false);
|
|
6
|
+
expect(isPrimitiveEmpty(new Number(100))).toBe(false);
|
|
7
|
+
expect(isPrimitiveEmpty(NaN)).toBe(false);
|
|
8
|
+
expect(isPrimitiveEmpty(undefined)).toBe(true);
|
|
9
|
+
expect(isPrimitiveEmpty(null)).toBe(true);
|
|
10
|
+
expect(isPrimitiveEmpty('a')).toBe(false);
|
|
11
|
+
expect(isPrimitiveEmpty(new Map())).toBe(false);
|
|
12
|
+
expect(isPrimitiveEmpty(new Set())).toBe(false);
|
|
13
|
+
expect(isPrimitiveEmpty(new Array(1))).toBe(false);
|
|
14
|
+
});
|