jis 2.0.3-preview.1 → 2.1.0-preview.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Deprecated
6
+ - Accessing type checks directly via `jis.is` and `jis.$*` is deprecated.
7
+ These APIs will be removed in v3.0.0.
8
+ Use `jis.types.*` and `jis.semantic.*` instead.
9
+
10
+ ### Added
11
+ - Introduced new namespaces: `jis.types` and `jis.semantic`
12
+
13
+ ## [2.0.2]
14
+ ### Fixed
15
+ - Fixed CI configuration to run `build` and `test` jobs only on merge requests to `dev` and `master`
16
+ - Fixed package publishing issue where the `dist/` folder was not included
17
+
18
+ ## [2.0.1]
19
+ ### Changed
20
+ - Migrated build system from webpack to Vite
21
+ - Integrated Vitest
22
+ - Integrated CI/CD (build, test, and deploy)
23
+
24
+ ### Notes
25
+ - Previous versions (< 2.0.1) were early iterations and did not follow a formal changelog.
package/README.md CHANGED
@@ -15,240 +15,283 @@ Static types disappear after transpilation, and runtime type checks are often li
15
15
  `jis` focuses on providing simple, reliable runtime `is` checks using the most stable and widely supported mechanisms in JavaScript.
16
16
 
17
17
  ### Installation
18
-
19
- ```shell script
20
- npm install jis
21
- ```
22
18
 
23
- You can install this library with `npm` or `yarn`. And you can add in `devDependencies` with
19
+ You can install this library with npm or yarn.
24
20
 
25
- ```shell script
26
- npm install jis --dev
21
+ ```shell script
22
+ npm install jis
27
23
  ```
28
24
 
29
25
  ### Usage
30
26
 
31
- ##### Import in ES5 or higher
27
+ #### Import in ES5 or higher
32
28
 
33
29
  ```js
34
- let jis = require('jis')
30
+ const jis = require('jis')
35
31
  ```
36
32
 
37
- ##### Import in TS
33
+ #### Import in TS
38
34
 
39
35
  ```ts
40
36
  import jis from 'jis'
41
37
  ```
42
38
 
43
- #### Methods
39
+ ### ⚠️ Backward compatibility
44
40
 
45
- ##### $array
41
+ In `v2.x`, legacy access via `jis.is` and `jis.$*` **still works for compatibility reasons**, but it is **deprecated** and will be removed in `v3.0.0`.
46
42
 
47
- ```js
48
-
49
- jis.$array( [] ) // true
50
-
51
- jis.$array( true ) //false
52
- jis.$array( function() {} ) // false
53
- jis.$array( null ) // false
54
- jis.$array( 12 ) // false
55
- jis.$array( {} ) // false
56
- jis.$array( '' ) // false
57
- jis.$array( undefined ) // false
43
+ If you are starting a new project or updating existing code, **use the new namespaces shown below**.
58
44
 
45
+ ```js
46
+ // Deprecated
47
+ jis.is(arg, type);
48
+ jis.$object(arg);
49
+ jis.$array(arg);
50
+ jis.$number(arg);
51
+ jis.$string(arg);
52
+ jis.$boolean(arg);
53
+ jis.$undefined(arg);
54
+ jis.$function(arg);
55
+ jis.$null(arg);
56
+
57
+ jis.$empty(arg);
58
+ jis.$numeric(arg);
59
+ jis.$primitive(arg);
59
60
  ```
60
61
 
61
- ##### $boolean
62
+ Use the new namespaces instead:
62
63
 
63
64
  ```js
65
+ jis.types.is(arg, type);
66
+ jis.types.$object(arg);
67
+ jis.types.$array(arg);
68
+ jis.types.$number(arg);
69
+ jis.types.$string(arg);
70
+ jis.types.$boolean(arg);
71
+ jis.types.$undefined(arg);
72
+ jis.types.$function(arg);
73
+ jis.types.$null(arg);
74
+
75
+ jis.semantic.$empty(arg);
76
+ jis.semantic.$numeric(arg);
77
+ jis.semantic.$primitive(arg);
78
+ ```
64
79
 
65
- jis.$boolean( true ) // true
66
- jis.$boolean( false ) // true
80
+ ## API
67
81
 
68
- jis.$boolean( [] ) //false
69
- jis.$boolean( function() {} ) // false
82
+ ### Type checks (`jis.types`)
83
+ #### $array
70
84
 
71
- // ...
85
+ ```js
86
+ const { $array } = jis.types // jis.types.$array
87
+
88
+ $array( [] ) // true
72
89
 
90
+ $array( true ) // false
91
+ $array( function() {} ) // false
92
+ $array( null ) // false
93
+ $array( 12 ) // false
94
+ $array( {} ) // false
95
+ $array( '' ) // false
96
+ $array( undefined ) // false
73
97
  ```
74
98
 
75
- ##### $function
99
+ #### $boolean
76
100
 
77
101
  ```js
102
+ const { $boolean } = jis.types
78
103
 
79
- jis.$function( function() {} ) // true
104
+ $boolean( true ) // true
105
+ $boolean( false ) // true
80
106
 
81
- jis.$function( 12 ) // false
82
- jis.$function( {} ) // false
83
- jis.$function( '' ) // false
107
+ $boolean( [] ) // false
108
+ $boolean( function() {} ) // false
84
109
 
85
110
  // ...
86
-
87
111
  ```
88
112
 
89
- ##### $null
113
+ #### $function
90
114
 
91
115
  ```js
116
+ const { $function } = jis.types
92
117
 
93
- jis.$null( null ) // true
118
+ $function( function() {} ) // true
94
119
 
95
- jis.$null( {} ) // false
96
- jis.$null( '' ) // false
97
- jis.$null( undefined ) // false
120
+ $function( 12 ) // false
121
+ $function( {} ) // false
122
+ $function( '' ) // false
98
123
 
99
124
  // ...
100
-
101
125
  ```
102
126
 
103
- ##### $number
127
+ #### $null
104
128
 
105
129
  ```js
130
+ const { $null } = jis.types
106
131
 
107
- jis.$number( 12 ) // true
132
+ $null( null ) // true
108
133
 
109
- jis.$number( function() {} ) // false
110
- jis.$number( null ) // false
111
- jis.$number( undefined ) // false
134
+ $null( {} ) // false
135
+ $null( '' ) // false
136
+ $null( undefined ) // false
112
137
 
113
138
  // ...
114
-
115
139
  ```
116
140
 
117
- ##### $object
141
+ #### $number
118
142
 
119
143
  ```js
144
+ const { $number } = jis.types
120
145
 
121
- jis.$object( {} ) // true
146
+ $number( 12 ) // true
122
147
 
123
- jis.$object( [] ) // false
124
- jis.$object( true ) //false
125
- jis.$object( 12 ) // false
148
+ $number( function() {} ) // false
149
+ $number( null ) // false
150
+ $number( undefined ) // false
126
151
 
127
152
  // ...
128
-
129
153
  ```
130
154
 
131
- ##### $string
155
+ #### $object
132
156
 
133
157
  ```js
158
+ const { $object } = jis.types
134
159
 
135
- jis.$string( 'Some text' ) // true
160
+ $object( {} ) // true
136
161
 
137
- jis.$string( [] ) // false
138
- jis.$string( true ) //false
139
- jis.$string( undefined ) // false
162
+ $object( [] ) // false
163
+ $object( true ) // false
164
+ $object( 12 ) // false
140
165
 
141
166
  // ...
142
-
143
167
  ```
144
168
 
145
- ##### $undefined
169
+ #### $string
146
170
 
147
171
  ```js
172
+ const { $string } = jis.types
148
173
 
149
- jis.$undefined( undefined ) // true
174
+ $string( 'Some text' ) // true
150
175
 
151
- jis.$undefined( [] ) // false
152
- jis.$undefined( {} ) // false
153
- jis.$undefined( '' ) // false
176
+ $string( [] ) // false
177
+ $string( true ) // false
178
+ $string( undefined ) // false
154
179
 
155
180
  // ...
156
-
157
181
  ```
158
182
 
159
- ##### $numeric
160
-
161
- Check if the argument is a number or number string (including exponential)
183
+ #### $undefined
162
184
 
163
185
  ```js
186
+ const { $undefined } = jis.types
164
187
 
165
- jis.$numeric( 12 ) // true
166
- jis.$numeric( '12' ) // true
167
- jis.$numeric( '-12' ) // true
168
- jis.$numeric( '+12' ) // true
169
- jis.$numeric( '12.' ) // true
170
- jis.$numeric( '12.e5' ) // true
171
- jis.$numeric( '12.E5' ) // true
172
- jis.$numeric( '12.E-5' ) // true
173
- jis.$numeric( '-12.E-5' ) // true
174
- jis.$numeric( '+12.E-5' ) // true
188
+ $undefined( undefined ) // true
175
189
 
176
- jis.$numeric( '12.E-' ) // false
177
- jis.$numeric( 'A3B' ) // false
178
- jis.$numeric( undefined ) // false
179
- jis.$numeric( null ) // false
190
+ $undefined( [] ) // false
191
+ $undefined( {} ) // false
192
+ $undefined( '' ) // false
180
193
 
194
+ // ...
181
195
  ```
182
196
 
183
- ##### $primitive
197
+ #### is
184
198
 
185
- Check if the argument is a primitive value
199
+ This method is the core of the library and provides more flexible and advanced type checks.
186
200
 
187
201
  ```js
202
+ const { is } = jis.types
203
+
204
+ is( [], 'Array' ) // true
205
+ is( false, 'Boolean' ) // true
206
+ is( true, 'Boolean' ) // true
207
+ is( function(){}, 'Function' ) // true
208
+ is( null, 'Null' ) // true
209
+ is( 12, 'Number' ) // true
210
+ is( {}, 'Object' ) // true
211
+ is( 'Text', 'String' ) // true
212
+ is( undefined, 'Undefined' ) // true
213
+
214
+ let date = new Date();
215
+ is(date, Date) // true
188
216
 
189
- jis.$primitive(undefined) // true
190
- jis.$primitive(null) // true
191
- jis.$primitive("something") // true
192
- jis.$primitive(true) // true
193
- jis.$primitive(false) // true
194
- jis.$primitive(12) // true
195
- jis.$primitive(Symbol()) // true
217
+ is(/^$/g, RegExp) // true
218
+ is(/^$/g, 'RegExp') // true
196
219
 
197
- jis.$primitive({}) // false
198
- jis.$primitive([]) // false
199
- jis.$primitive(new Date()) // false
220
+ is(12, 12) // true
221
+ is(12, 13) // false
200
222
 
223
+ // ... experiment with this method :D
201
224
  ```
202
225
 
203
- ##### $empty
226
+ ### Semantic checks (`jis.semantic`)
227
+ #### $numeric
204
228
 
205
- $empty follows a semantic definition of emptiness, where certain falsy or zero-like values are intentionally considered empty.
229
+ Check if the argument is a number or number string (including exponential)
206
230
 
207
231
  ```js
208
-
209
- jis.$empty(null) // true
210
- jis.$empty(undefined) // true
211
- jis.$empty(false) // true
212
- jis.$empty(0) // true
213
- jis.$empty(0.0) // true
214
- jis.$empty("") // true
215
- jis.$empty("0") // true
216
- jis.$empty([]) // true
217
-
218
- jis.$empty(true) // false
219
- jis.$empty(12) // false
220
- jis.$empty(12.0) // false
221
- jis.$empty("something") // false
222
- jis.$empty("012") // false
223
- jis.$empty([1, 2, 3]) // false
224
-
232
+ const { $numeric } = jis.semantic // jis.semantic.$numeric
233
+
234
+ $numeric( 12 ) // true
235
+ $numeric( '12' ) // true
236
+ $numeric( '-12' ) // true
237
+ $numeric( '+12' ) // true
238
+ $numeric( '12.' ) // true
239
+ $numeric( '12.e5' ) // true
240
+ $numeric( '12.E5' ) // true
241
+ $numeric( '12.E-5' ) // true
242
+ $numeric( '-12.E-5' ) // true
243
+ $numeric( '+12.E-5' ) // true
244
+
245
+ $numeric( '12.E-' ) // false
246
+ $numeric( 'A3B' ) // false
247
+ $numeric( undefined ) // false
248
+ $numeric( null ) // false
225
249
  ```
226
250
 
227
- ##### is
251
+ #### $primitive
228
252
 
229
- This method is the core of the library and provides more flexible and advanced type checks.
253
+ Check if the argument is a primitive value
230
254
 
231
255
  ```js
256
+ const { $primitive } = jis.semantic
257
+
258
+ $primitive(undefined) // true
259
+ $primitive(null) // true
260
+ $primitive("something") // true
261
+ $primitive(true) // true
262
+ $primitive(false) // true
263
+ $primitive(12) // true
264
+ $primitive(Symbol()) // true
265
+
266
+ $primitive({}) // false
267
+ $primitive([]) // false
268
+ $primitive(new Date()) // false
269
+ ```
232
270
 
233
- jis.is( [], 'Array' ) // true
234
- jis.is( false, 'Boolean' ) // true
235
- jis.is( true, 'Boolean' ) // true
236
- jis.is( function(){}, 'Function' ) // true
237
- jis.is( null, 'Null' ) // true
238
- jis.is( 12, 'Number' ) // true
239
- jis.is( {}, 'Object' ) // true
240
- jis.is( 'Text', 'String' ) // true
241
- jis.is( undefined, 'Undefined' ) // true
242
-
243
- let date = new Date();
244
- jis.is(date, Date) // true
271
+ #### $empty
245
272
 
246
- jis.is(/^$/g, RegExp) // true
247
- jis.is(/^$/g, 'RegExp') // true
273
+ $empty follows a semantic definition of emptiness, where certain falsy or zero-like values are intentionally considered empty.
248
274
 
249
- jis.is(12, 12) // true
250
- jis.is(12, 13) // false
275
+ ```js
276
+ const { $empty } = jis.semantic
277
+
278
+ $empty(null) // true
279
+ $empty(undefined) // true
280
+ $empty(false) // true
281
+ $empty(0) // true
282
+ $empty(0.0) // true
283
+ $empty("") // true
284
+ $empty("0") // true
285
+ $empty([]) // true
286
+
287
+ $empty(true) // false
288
+ $empty(12) // false
289
+ $empty(12.0) // false
290
+ $empty("something") // false
291
+ $empty("012") // false
292
+ $empty([1, 2, 3]) // false
293
+ ```
251
294
 
252
- // ... experiment with this method :D
295
+ ## Changelog
253
296
 
254
- ```
297
+ See [CHANGELOG.md](./CHANGELOG.md) for version history and breaking changes.
package/dist/Is.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Gen } from './interfaces/main.ts';
1
+ import { IGen } from './interfaces/main.ts';
2
2
  export default class Is {
3
3
  private static callToString;
4
4
  static $string(arg: any): boolean;
@@ -10,8 +10,5 @@ export default class Is {
10
10
  static $undefined(arg: any): boolean;
11
11
  static $boolean(arg: any): boolean;
12
12
  static $function(arg: any): boolean;
13
- static objectIsValid(data: Gen, rules: Gen): boolean;
14
- static $numeric(arg: any): boolean;
15
- static $primitive(arg: any): boolean;
16
- static $empty(arg: any): boolean;
13
+ static objectIsValid(data: IGen, rules: IGen): boolean;
17
14
  }
@@ -0,0 +1,5 @@
1
+ export default class Semantic {
2
+ static $numeric(arg: any): boolean;
3
+ static $primitive(arg: any): boolean;
4
+ static $empty(arg: any): boolean;
5
+ }
@@ -0,0 +1,28 @@
1
+ import { default as Is } from '../Is';
2
+ import { default as Semantic } from '../Semantic.ts';
3
+ export default interface ILegacyApi {
4
+ /** @deprecated Use `jis.types.is`. It'll be remove in v3.0.0 **/
5
+ is: typeof Is.is;
6
+ /** @deprecated Use `jis.types.$object`. It'll be remove in v3.0.0 **/
7
+ $object: typeof Is.$object;
8
+ /** @deprecated Use `jis.types.$array`. It'll be remove in v3.0.0 **/
9
+ $array: typeof Is.$array;
10
+ /** @deprecated Use `jis.types.$number`. It'll be remove in v3.0.0 **/
11
+ $number: typeof Is.$number;
12
+ /** @deprecated Use `jis.types.$string`. It'll be remove in v3.0.0 **/
13
+ $string: typeof Is.$string;
14
+ /** @deprecated Use `jis.types.$boolean`. It'll be remove in v3.0.0 **/
15
+ $boolean: typeof Is.$boolean;
16
+ /** @deprecated Use `jis.types.$undefined`. It'll be remove in v3.0.0 **/
17
+ $undefined: typeof Is.$undefined;
18
+ /** @deprecated Use `jis.types.$function`. It'll be remove in v3.0.0 **/
19
+ $function: typeof Is.$function;
20
+ /** @deprecated Use `jis.types.$null`. It'll be remove in v3.0.0 **/
21
+ $null: typeof Is.$null;
22
+ /** @deprecated Use `jis.semantic.$empty`. It'll be remove in v3.0.0 **/
23
+ $empty: typeof Semantic.$empty;
24
+ /** @deprecated Use `jis.semantic.$numeric`. It'll be remove in v3.0.0 **/
25
+ $numeric: typeof Semantic.$numeric;
26
+ /** @deprecated Use `jis.semantic.$primitive`. It'll be remove in v3.0.0 **/
27
+ $primitive: typeof Semantic.$primitive;
28
+ }
@@ -1,3 +1,3 @@
1
- export interface Gen extends Object {
1
+ export interface IGen extends Object {
2
2
  [key: string]: any;
3
3
  }
package/dist/jis.js CHANGED
@@ -1,76 +1,111 @@
1
- class e {
2
- static callToString(t) {
3
- return Object.prototype.toString.call(t);
1
+ class t {
2
+ static callToString(e) {
3
+ return Object.prototype.toString.call(e);
4
4
  }
5
- static $string(t) {
6
- return e.callToString(t) === "[object String]";
5
+ static $string(e) {
6
+ return t.callToString(e) === "[object String]";
7
7
  }
8
- static is(t, n) {
9
- return e.$function(n) ? t instanceof n : e.$string(n) ? e.callToString(t) === `[object ${n}]` : t === n;
8
+ static is(e, r) {
9
+ return t.$function(r) ? e instanceof r : t.$string(r) ? t.callToString(e) === `[object ${r}]` : e === r;
10
10
  }
11
- static $array(t) {
12
- return e.is(t, "Array");
11
+ static $array(e) {
12
+ return t.is(e, "Array");
13
13
  }
14
- static $null(t) {
15
- return e.is(t, "Null");
14
+ static $null(e) {
15
+ return t.is(e, "Null");
16
16
  }
17
- static $number(t) {
18
- return e.is(t, "Number");
17
+ static $number(e) {
18
+ return t.is(e, "Number");
19
19
  }
20
- static $object(t) {
21
- return e.is(t, "Object");
20
+ static $object(e) {
21
+ return t.is(e, "Object");
22
22
  }
23
- static $undefined(t) {
24
- return e.is(t, "Undefined");
23
+ static $undefined(e) {
24
+ return t.is(e, "Undefined");
25
25
  }
26
- static $boolean(t) {
27
- return e.is(t, "Boolean");
26
+ static $boolean(e) {
27
+ return t.is(e, "Boolean");
28
28
  }
29
- static $function(t) {
30
- return e.callToString(t) === "[object Function]";
29
+ static $function(e) {
30
+ return t.callToString(e) === "[object Function]";
31
31
  }
32
- static objectIsValid(t, n) {
33
- if (!e.$object(t)) throw new Error("The data parameter must be an Object");
34
- if (!e.$object(n)) throw new Error("The rules parameter must be an Object");
35
- let r = !0;
36
- return Object.getOwnPropertyNames(n).forEach((a) => {
37
- let i = n[a];
38
- if (e.$array(i)) {
39
- if (i.length < 1) return;
40
- let l = !1;
41
- return i.forEach((o) => {
42
- l = l || e.is(t[a], o);
43
- }), r = r && l;
32
+ static objectIsValid(e, r) {
33
+ if (!t.$object(e)) throw new Error("The data parameter must be an Object");
34
+ if (!t.$object(r)) throw new Error("The rules parameter must be an Object");
35
+ let n = !0;
36
+ return Object.getOwnPropertyNames(r).forEach((i) => {
37
+ let a = r[i];
38
+ if (t.$array(a)) {
39
+ if (a.length < 1) return;
40
+ let o = !1;
41
+ return a.forEach((s) => {
42
+ o = o || t.is(e[i], s);
43
+ }), n = n && o;
44
44
  }
45
- r = r && e.is(t[a], i);
46
- }), r;
45
+ n = n && t.is(e[i], a);
46
+ }), n;
47
47
  }
48
- static $numeric(t) {
49
- if (e.$number(t))
50
- return !0;
51
- let n = String(t || "");
52
- return /^[-+]?(([0-9]+)|([0-9]*(\.[0-9]+))|([0-9]+\.))([Ee]([-+]?[0-9]+))?$/g.test(n);
48
+ }
49
+ class l {
50
+ static $numeric(e) {
51
+ return [
52
+ t.$number,
53
+ (n) => {
54
+ let c = String(n || "");
55
+ return /^[-+]?(([0-9]+)|([0-9]*(\.[0-9]+))|([0-9]+\.))([Ee]([-+]?[0-9]+))?$/g.test(c);
56
+ }
57
+ ].some((n) => n(e));
53
58
  }
54
- static $primitive(t) {
59
+ static $primitive(e) {
55
60
  return [
56
- e.$undefined,
57
- e.$null,
58
- e.$boolean,
59
- e.$number,
60
- e.$string,
61
- (r) => e.is(r, "Symbol")
62
- ].some((r) => r(t));
61
+ t.$undefined,
62
+ t.$null,
63
+ t.$boolean,
64
+ t.$number,
65
+ t.$string,
66
+ (n) => t.is(n, "Symbol")
67
+ ].some((n) => n(e));
63
68
  }
64
- static $empty(t) {
69
+ static $empty(e) {
65
70
  return [
66
- e.$undefined,
67
- e.$null,
68
- (r) => e.$boolean(r) && !r,
69
- (r) => e.$number(r) && r === 0,
70
- (r) => (e.$array(r) || e.$string(r)) && (r === "0" || r.length === 0)
71
- ].some((r) => r(t));
71
+ t.$undefined,
72
+ t.$null,
73
+ (n) => t.$boolean(n) && !n,
74
+ (n) => t.$number(n) && n === 0,
75
+ (n) => (t.$array(n) || t.$string(n)) && (n === "0" || n.length === 0)
76
+ ].some((n) => n(e));
72
77
  }
73
78
  }
79
+ const {
80
+ is: $,
81
+ $array: u,
82
+ $object: b,
83
+ $number: m,
84
+ $string: f,
85
+ $boolean: d,
86
+ $undefined: j,
87
+ $function: g,
88
+ $null: p
89
+ } = t, {
90
+ $primitive: S,
91
+ $empty: h,
92
+ $numeric: v
93
+ } = l, O = {
94
+ types: t,
95
+ semantic: l,
96
+ is: $,
97
+ $object: b,
98
+ $array: u,
99
+ $number: m,
100
+ $string: f,
101
+ $boolean: d,
102
+ $undefined: j,
103
+ $function: g,
104
+ $null: p,
105
+ $empty: h,
106
+ $numeric: v,
107
+ $primitive: S
108
+ };
74
109
  export {
75
- e as default
110
+ O as default
76
111
  };
package/dist/jis.umd.cjs CHANGED
@@ -1 +1 @@
1
- (function(t,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(t=typeof globalThis<"u"?globalThis:t||self,t.jis=o())})(this,(function(){"use strict";class t{static callToString(e){return Object.prototype.toString.call(e)}static $string(e){return t.callToString(e)==="[object String]"}static is(e,r){return t.$function(r)?e instanceof r:t.$string(r)?t.callToString(e)===`[object ${r}]`:e===r}static $array(e){return t.is(e,"Array")}static $null(e){return t.is(e,"Null")}static $number(e){return t.is(e,"Number")}static $object(e){return t.is(e,"Object")}static $undefined(e){return t.is(e,"Undefined")}static $boolean(e){return t.is(e,"Boolean")}static $function(e){return t.callToString(e)==="[object Function]"}static objectIsValid(e,r){if(!t.$object(e))throw new Error("The data parameter must be an Object");if(!t.$object(r))throw new Error("The rules parameter must be an Object");let n=!0;return Object.getOwnPropertyNames(r).forEach(u=>{let i=r[u];if(t.$array(i)){if(i.length<1)return;let l=!1;return i.forEach(a=>{l=l||t.is(e[u],a)}),n=n&&l}n=n&&t.is(e[u],i)}),n}static $numeric(e){if(t.$number(e))return!0;let r=String(e||"");return/^[-+]?(([0-9]+)|([0-9]*(\.[0-9]+))|([0-9]+\.))([Ee]([-+]?[0-9]+))?$/g.test(r)}static $primitive(e){return[t.$undefined,t.$null,t.$boolean,t.$number,t.$string,n=>t.is(n,"Symbol")].some(n=>n(e))}static $empty(e){return[t.$undefined,t.$null,n=>t.$boolean(n)&&!n,n=>t.$number(n)&&n===0,n=>(t.$array(n)||t.$string(n))&&(n==="0"||n.length===0)].some(n=>n(e))}}return t}));
1
+ (function(t,r){typeof exports=="object"&&typeof module<"u"?module.exports=r():typeof define=="function"&&define.amd?define(r):(t=typeof globalThis<"u"?globalThis:t||self,t.jis=r())})(this,(function(){"use strict";class t{static callToString(e){return Object.prototype.toString.call(e)}static $string(e){return t.callToString(e)==="[object String]"}static is(e,i){return t.$function(i)?e instanceof i:t.$string(i)?t.callToString(e)===`[object ${i}]`:e===i}static $array(e){return t.is(e,"Array")}static $null(e){return t.is(e,"Null")}static $number(e){return t.is(e,"Number")}static $object(e){return t.is(e,"Object")}static $undefined(e){return t.is(e,"Undefined")}static $boolean(e){return t.is(e,"Boolean")}static $function(e){return t.callToString(e)==="[object Function]"}static objectIsValid(e,i){if(!t.$object(e))throw new Error("The data parameter must be an Object");if(!t.$object(i))throw new Error("The rules parameter must be an Object");let n=!0;return Object.getOwnPropertyNames(i).forEach(o=>{let a=i[o];if(t.$array(a)){if(a.length<1)return;let c=!1;return a.forEach(S=>{c=c||t.is(e[o],S)}),n=n&&c}n=n&&t.is(e[o],a)}),n}}class r{static $numeric(e){return[t.$number,n=>{let s=String(n||"");return/^[-+]?(([0-9]+)|([0-9]*(\.[0-9]+))|([0-9]+\.))([Ee]([-+]?[0-9]+))?$/g.test(s)}].some(n=>n(e))}static $primitive(e){return[t.$undefined,t.$null,t.$boolean,t.$number,t.$string,n=>t.is(n,"Symbol")].some(n=>n(e))}static $empty(e){return[t.$undefined,t.$null,n=>t.$boolean(n)&&!n,n=>t.$number(n)&&n===0,n=>(t.$array(n)||t.$string(n))&&(n==="0"||n.length===0)].some(n=>n(e))}}const{is:u,$array:l,$object:$,$number:f,$string:b,$boolean:d,$undefined:m,$function:p,$null:j}=t,{$primitive:g,$empty:h,$numeric:y}=r;return{types:t,semantic:r,is:u,$object:$,$array:l,$number:f,$string:b,$boolean:d,$undefined:m,$function:p,$null:j,$empty:h,$numeric:y,$primitive:g}}));
package/dist/main.d.ts CHANGED
@@ -1,2 +1,8 @@
1
1
  import { default as Is } from './Is.ts';
2
- export default Is;
2
+ import { default as ILegacyApi } from './interfaces/ILegacyApi.ts';
3
+ import { default as Semantic } from './Semantic.ts';
4
+ declare const api: ILegacyApi & {
5
+ types: typeof Is;
6
+ semantic: typeof Semantic;
7
+ };
8
+ export default api;
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "jis",
3
3
  "private": false,
4
- "version": "2.0.3-preview.1",
4
+ "version": "2.1.0-preview.1",
5
5
  "description": "When you need validate the variable data type",
6
6
  "type": "module",
7
7
  "main": "./dist/jis.umd.cjs",
8
8
  "module": "./dist/jis.js",
9
9
  "types": "./dist/main.d.ts",
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "CHANGELOG.md"
12
13
  ],
13
14
  "exports": {
14
15
  ".": {