@leismore/lmos-nodejs-primitives 1.0.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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.js +29 -0
- package/package.json +47 -0
- package/tsconfig.json +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Leismore
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# lmos-nodejs-primitives
|
|
2
|
+
|
|
3
|
+
Examples of all primitive values in JavaScript. Defined for writing unit test.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
`npm install @leismore/lmos-nodejs-primitives`
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import {
|
|
13
|
+
NULL , UNDEFINED ,
|
|
14
|
+
TRUE , FALSE ,
|
|
15
|
+
INTEGER , INTEGER_NEGATIVE ,
|
|
16
|
+
FLOAT , FLOAT_NEGATIVE ,
|
|
17
|
+
BIGINT , BIGINT_NEGATIVE ,
|
|
18
|
+
STRING , STRING_EMPTY , STRING_MULTILINE,
|
|
19
|
+
SYMBOL
|
|
20
|
+
} from '@leismore/lmos-nodejs-primitives';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
© [Leismore](https://www.leismore.co) 2025
|
|
26
|
+
|
|
27
|
+
[MIT License](https://choosealicense.com/licenses/mit)
|
|
28
|
+
|
|
29
|
+
## Authors
|
|
30
|
+
|
|
31
|
+
* [Kyle Chine / Kai Qin / 秦凯](https://kyle.chine.leismore.org) since 03 Aug 2025
|
|
32
|
+
|
|
33
|
+
## References
|
|
34
|
+
|
|
35
|
+
* mdn web docs - JavaScript data types and data structures - Primitive values <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
------------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
Product of [Leismore OpenSource](https://lmos.leismore.org) Project
|
|
43
|
+
|
|
44
|
+
Supported by [Leismore](https://www.leismore.co) (Australian Business Number: 25 935 862 619)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define examples of each primitive value in JavaScript
|
|
3
|
+
*/
|
|
4
|
+
declare const NULL: null;
|
|
5
|
+
declare const UNDEFINED: undefined;
|
|
6
|
+
declare const TRUE = true;
|
|
7
|
+
declare const FALSE = false;
|
|
8
|
+
declare const INTEGER = 42;
|
|
9
|
+
declare const INTEGER_NEGATIVE = -42;
|
|
10
|
+
declare const FLOAT = 3.14;
|
|
11
|
+
declare const FLOAT_NEGATIVE = -3.14;
|
|
12
|
+
declare const BIGINT: bigint;
|
|
13
|
+
declare const BIGINT_NEGATIVE: bigint;
|
|
14
|
+
declare const STRING = "Hello, World!";
|
|
15
|
+
declare const STRING_EMPTY = "";
|
|
16
|
+
declare const STRING_MULTILINE: string;
|
|
17
|
+
declare const SYMBOL: unique symbol;
|
|
18
|
+
export { NULL, UNDEFINED, TRUE, FALSE, INTEGER, INTEGER_NEGATIVE, FLOAT, FLOAT_NEGATIVE, BIGINT, BIGINT_NEGATIVE, STRING, STRING_EMPTY, STRING_MULTILINE, SYMBOL };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define examples of each primitive value in JavaScript
|
|
3
|
+
*/
|
|
4
|
+
import { EOL } from 'os';
|
|
5
|
+
// Null
|
|
6
|
+
const NULL = null;
|
|
7
|
+
// Undefined
|
|
8
|
+
const UNDEFINED = undefined;
|
|
9
|
+
// Boolean
|
|
10
|
+
const TRUE = true;
|
|
11
|
+
const FALSE = false;
|
|
12
|
+
// Number
|
|
13
|
+
const INTEGER = 42;
|
|
14
|
+
const INTEGER_NEGATIVE = -42;
|
|
15
|
+
const FLOAT = 3.14;
|
|
16
|
+
const FLOAT_NEGATIVE = -3.14;
|
|
17
|
+
// BigInt
|
|
18
|
+
const BIGINT = BigInt(Number.MAX_SAFE_INTEGER) + BigInt(1);
|
|
19
|
+
const BIGINT_NEGATIVE = BigInt(Number.MIN_SAFE_INTEGER) - BigInt(1);
|
|
20
|
+
// String
|
|
21
|
+
const STRING = 'Hello, World!';
|
|
22
|
+
const STRING_EMPTY = '';
|
|
23
|
+
const STRING_MULTILINE = ('This is a string' + EOL +
|
|
24
|
+
'that spans multiple lines.' + EOL +
|
|
25
|
+
'It includes line breaks.' + EOL);
|
|
26
|
+
// Symbol
|
|
27
|
+
const SYMBOL = Symbol();
|
|
28
|
+
// Export all defined primitive values
|
|
29
|
+
export { NULL, UNDEFINED, TRUE, FALSE, INTEGER, INTEGER_NEGATIVE, FLOAT, FLOAT_NEGATIVE, BIGINT, BIGINT_NEGATIVE, STRING, STRING_EMPTY, STRING_MULTILINE, SYMBOL };
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leismore/lmos-nodejs-primitives",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Examples of all primitive values in JavaScript. Defined for writing unit test.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"JavaScript",
|
|
7
|
+
"Primitive Values",
|
|
8
|
+
"Unit Test",
|
|
9
|
+
"LMOS for Node.js",
|
|
10
|
+
"LMOS",
|
|
11
|
+
"Leismore OpenSource",
|
|
12
|
+
"Leismore",
|
|
13
|
+
"Node.js",
|
|
14
|
+
"NodeJS",
|
|
15
|
+
"Node"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/leismore/lmos-nodejs-primitives#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/leismore/lmos-nodejs-primitives/issues"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/leismore/lmos-nodejs-primitives.git"
|
|
24
|
+
},
|
|
25
|
+
"funding": {
|
|
26
|
+
"type": "github",
|
|
27
|
+
"url": "https://github.com/sponsors/leismore"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "Kyle Chine",
|
|
32
|
+
"url": "https://kyle.chine.leismore.org",
|
|
33
|
+
"email": "kyle.chine@leismore.co"
|
|
34
|
+
},
|
|
35
|
+
"type": "module",
|
|
36
|
+
"main": "dist/src/index.js",
|
|
37
|
+
"types": "dist/src/index.d.ts",
|
|
38
|
+
"scripts": {
|
|
39
|
+
"test": "tsx test/test.ts",
|
|
40
|
+
"build": "tsc"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.17.0",
|
|
44
|
+
"tsx": "^4.20.3",
|
|
45
|
+
"typescript": "^5.9.2"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions":
|
|
3
|
+
{
|
|
4
|
+
"lib": ["ES2023"],
|
|
5
|
+
"target": "ES2023",
|
|
6
|
+
"module": "nodenext",
|
|
7
|
+
"moduleResolution": "nodenext",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"allowJs": false,
|
|
12
|
+
"outDir": "dist",
|
|
13
|
+
"paths": {
|
|
14
|
+
"@lib/*": ["./src/lib/*"],
|
|
15
|
+
"@test/lib/*": ["./test/lib/*"]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*", "test/**/*"]
|
|
19
|
+
}
|