@guanghechen/invariant 6.0.4 → 7.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/README.md +9 -9
- package/lib/cjs/index.cjs +1 -1
- package/lib/esm/index.mjs +1 -1
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<header>
|
|
2
2
|
<h1 align="center">
|
|
3
|
-
<a href="https://github.com/guanghechen/sora/tree/@guanghechen/invariant@
|
|
3
|
+
<a href="https://github.com/guanghechen/sora/tree/@guanghechen/invariant@7.0.0/packages/invariant#readme">@guanghechen/invariant</a>
|
|
4
4
|
</h1>
|
|
5
5
|
<div align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/@guanghechen/invariant">
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</a>
|
|
24
24
|
<a href="#install">
|
|
25
25
|
<img
|
|
26
|
-
alt="Module
|
|
26
|
+
alt="Module Formats: cjs, esm"
|
|
27
27
|
src="https://img.shields.io/badge/module_formats-cjs%2C%20esm-green.svg"
|
|
28
28
|
/>
|
|
29
29
|
</a>
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
</header>
|
|
44
44
|
<br/>
|
|
45
45
|
|
|
46
|
-
An invariant function, which takes a `condition` and
|
|
47
|
-
and
|
|
46
|
+
An invariant function, which takes a `condition` and an optional `message` value,
|
|
47
|
+
and throws an error when the given condition fails.
|
|
48
48
|
|
|
49
49
|
## Install
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
- npm
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
npm install --save @guanghechen/invariant
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
- yarn
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
yarn add @guanghechen/invariant
|
|
@@ -63,7 +63,7 @@ and throw an error when the given condition fails.
|
|
|
63
63
|
|
|
64
64
|
## Usage
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
- Syntax
|
|
67
67
|
|
|
68
68
|
```typescript
|
|
69
69
|
function invariant(
|
|
@@ -72,7 +72,7 @@ and throw an error when the given condition fails.
|
|
|
72
72
|
): asserts condition
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
- Demo
|
|
76
76
|
|
|
77
77
|
```typescript
|
|
78
78
|
import invariant from '@guanghechen/invariant'
|
|
@@ -84,5 +84,5 @@ and throw an error when the given condition fails.
|
|
|
84
84
|
|
|
85
85
|
## Related
|
|
86
86
|
|
|
87
|
-
[homepage]: https://github.com/guanghechen/sora/tree/@guanghechen/invariant@
|
|
87
|
+
[homepage]: https://github.com/guanghechen/sora/tree/@guanghechen/invariant@7.0.0/packages/invariant#readme
|
|
88
88
|
[tiny-invariant]: https://github.com/alexreardon/tiny-invariant
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const isProduction = process.env
|
|
5
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
6
6
|
const prefix = 'Invariant failed';
|
|
7
7
|
function invariant(condition, message) {
|
|
8
8
|
if (condition)
|
package/lib/esm/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guanghechen/invariant",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "A simple invariant function",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "guanghechen",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/guanghechen/sora/tree/@guanghechen/invariant@6.0.
|
|
11
|
+
"url": "https://github.com/guanghechen/sora/tree/@guanghechen/invariant@6.0.5",
|
|
12
12
|
"directory": "packages/invariant"
|
|
13
13
|
},
|
|
14
|
-
"homepage": "https://github.com/guanghechen/sora/tree/@guanghechen/invariant@6.0.
|
|
14
|
+
"homepage": "https://github.com/guanghechen/sora/tree/@guanghechen/invariant@6.0.5/packages/invariant#readme",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -26,6 +26,13 @@
|
|
|
26
26
|
"module": "./lib/esm/index.mjs",
|
|
27
27
|
"types": "./lib/types/index.d.ts",
|
|
28
28
|
"license": "MIT",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "rollup -c ../../rollup.config.mjs",
|
|
31
|
+
"clean": "rimraf lib",
|
|
32
|
+
"test": "vitest run --config ../../vitest.config.ts",
|
|
33
|
+
"test:coverage": "vitest run --config ../../vitest.config.ts --coverage",
|
|
34
|
+
"test:update": "vitest run --config ../../vitest.config.ts -u"
|
|
35
|
+
},
|
|
29
36
|
"engines": {
|
|
30
37
|
"node": ">= 18.0.0"
|
|
31
38
|
},
|
|
@@ -37,5 +44,5 @@
|
|
|
37
44
|
"LICENSE",
|
|
38
45
|
"README.md"
|
|
39
46
|
],
|
|
40
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "12990a720b31d50d217e2e17a6191256dc94eda6"
|
|
41
48
|
}
|