@sinclair/typebox 0.24.23 → 0.24.26
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/compiler/compiler.d.ts +8 -1
- package/compiler/compiler.js +119 -55
- package/compiler/index.d.ts +1 -1
- package/compiler/index.js +2 -2
- package/{error → errors}/errors.d.ts +4 -0
- package/{error → errors}/errors.js +77 -51
- package/errors/index.d.ts +1 -0
- package/{compiler/property.js → errors/index.js} +16 -36
- package/guard/guard.js +83 -17
- package/package.json +1 -1
- package/readme.md +57 -55
- package/value/cast.d.ts +4 -0
- package/value/cast.js +75 -52
- package/value/check.d.ts +4 -0
- package/value/check.js +76 -50
- package/value/create.d.ts +4 -0
- package/value/create.js +75 -53
- package/value/index.d.ts +1 -1
- package/value/index.js +2 -2
- package/value/value.d.ts +1 -1
- package/value/value.js +2 -2
- package/compiler/property.d.ts +0 -4
package/compiler/compiler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ValueError } from '../
|
|
1
|
+
import { ValueError } from '../errors/index';
|
|
2
2
|
import * as Types from '../typebox';
|
|
3
3
|
export declare type CheckFunction = (value: unknown) => boolean;
|
|
4
4
|
export declare class TypeCheck<T extends Types.TSchema> {
|
|
@@ -14,6 +14,13 @@ export declare class TypeCheck<T extends Types.TSchema> {
|
|
|
14
14
|
/** Returns true if the value matches the given type. */
|
|
15
15
|
Check(value: unknown): value is Types.Static<T>;
|
|
16
16
|
}
|
|
17
|
+
export declare namespace Property {
|
|
18
|
+
function Check(propertyName: string): boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class TypeCompilerInvalidTypeError extends Error {
|
|
21
|
+
readonly schema: Types.TSchema;
|
|
22
|
+
constructor(schema: Types.TSchema);
|
|
23
|
+
}
|
|
17
24
|
/** Compiles Types for Runtime Type Checking */
|
|
18
25
|
export declare namespace TypeCompiler {
|
|
19
26
|
/** Compiles the given type for runtime type checking. This compiler only accepts known TypeBox types non-inclusive of unsafe types. */
|
package/compiler/compiler.js
CHANGED
|
@@ -27,10 +27,9 @@ THE SOFTWARE.
|
|
|
27
27
|
|
|
28
28
|
---------------------------------------------------------------------------*/
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.TypeCompiler = exports.TypeCheck = void 0;
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const Types = require("../typebox");
|
|
30
|
+
exports.TypeCompiler = exports.TypeCompilerInvalidTypeError = exports.Property = exports.TypeCheck = void 0;
|
|
31
|
+
const index_1 = require("../errors/index");
|
|
32
|
+
const index_2 = require("../guard/index");
|
|
34
33
|
// -------------------------------------------------------------------
|
|
35
34
|
// TypeCheck
|
|
36
35
|
// -------------------------------------------------------------------
|
|
@@ -47,7 +46,7 @@ class TypeCheck {
|
|
|
47
46
|
}
|
|
48
47
|
/** Returns an iterator for each error in this value. */
|
|
49
48
|
Errors(value) {
|
|
50
|
-
return
|
|
49
|
+
return index_1.ValueErrors.Errors(this.schema, this.references, value);
|
|
51
50
|
}
|
|
52
51
|
/** Returns true if the value matches the given type. */
|
|
53
52
|
Check(value) {
|
|
@@ -56,8 +55,51 @@ class TypeCheck {
|
|
|
56
55
|
}
|
|
57
56
|
exports.TypeCheck = TypeCheck;
|
|
58
57
|
// -------------------------------------------------------------------
|
|
58
|
+
// Property
|
|
59
|
+
// -------------------------------------------------------------------
|
|
60
|
+
var Property;
|
|
61
|
+
(function (Property) {
|
|
62
|
+
function DollarSign(code) {
|
|
63
|
+
return code === 36;
|
|
64
|
+
}
|
|
65
|
+
function Underscore(code) {
|
|
66
|
+
return code === 95;
|
|
67
|
+
}
|
|
68
|
+
function Numeric(code) {
|
|
69
|
+
return code >= 48 && code <= 57;
|
|
70
|
+
}
|
|
71
|
+
function Alpha(code) {
|
|
72
|
+
return (code >= 65 && code <= 90) || (code >= 97 && code <= 122);
|
|
73
|
+
}
|
|
74
|
+
function Check(propertyName) {
|
|
75
|
+
if (propertyName.length === 0)
|
|
76
|
+
return false;
|
|
77
|
+
{
|
|
78
|
+
const code = propertyName.charCodeAt(0);
|
|
79
|
+
if (!(DollarSign(code) || Underscore(code) || Alpha(code))) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (let i = 1; i < propertyName.length; i++) {
|
|
84
|
+
const code = propertyName.charCodeAt(i);
|
|
85
|
+
if (!(DollarSign(code) || Underscore(code) || Alpha(code) || Numeric(code))) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
Property.Check = Check;
|
|
92
|
+
})(Property = exports.Property || (exports.Property = {}));
|
|
93
|
+
// -------------------------------------------------------------------
|
|
59
94
|
// TypeCompiler
|
|
60
95
|
// -------------------------------------------------------------------
|
|
96
|
+
class TypeCompilerInvalidTypeError extends Error {
|
|
97
|
+
constructor(schema) {
|
|
98
|
+
super('TypeCompiler: Invalid type');
|
|
99
|
+
this.schema = schema;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.TypeCompilerInvalidTypeError = TypeCompilerInvalidTypeError;
|
|
61
103
|
/** Compiles Types for Runtime Type Checking */
|
|
62
104
|
var TypeCompiler;
|
|
63
105
|
(function (TypeCompiler) {
|
|
@@ -81,7 +123,7 @@ var TypeCompiler;
|
|
|
81
123
|
yield `(typeof ${value} === 'boolean')`;
|
|
82
124
|
}
|
|
83
125
|
function* Constructor(schema, value) {
|
|
84
|
-
yield* Visit(schema.returns, value);
|
|
126
|
+
yield* Visit(schema.returns, `${value}.prototype`);
|
|
85
127
|
}
|
|
86
128
|
function* Function(schema, value) {
|
|
87
129
|
yield `(typeof ${value} === 'function')`;
|
|
@@ -100,11 +142,14 @@ var TypeCompiler;
|
|
|
100
142
|
yield `(${value} <= ${schema.maximum})`;
|
|
101
143
|
}
|
|
102
144
|
function* Literal(schema, value) {
|
|
103
|
-
if (typeof schema.const === '
|
|
145
|
+
if (typeof schema.const === 'number' || typeof schema.const === 'boolean') {
|
|
146
|
+
yield `(${value} === ${schema.const})`;
|
|
147
|
+
}
|
|
148
|
+
else if (typeof schema.const === 'string') {
|
|
104
149
|
yield `(${value} === '${schema.const}')`;
|
|
105
150
|
}
|
|
106
151
|
else {
|
|
107
|
-
|
|
152
|
+
throw Error('TypeCompiler: Literal value should be string, number or boolean');
|
|
108
153
|
}
|
|
109
154
|
}
|
|
110
155
|
function* Null(schema, value) {
|
|
@@ -144,7 +189,7 @@ var TypeCompiler;
|
|
|
144
189
|
}
|
|
145
190
|
}
|
|
146
191
|
for (const propertyKey of propertyKeys) {
|
|
147
|
-
const memberExpression =
|
|
192
|
+
const memberExpression = Property.Check(propertyKey) ? `${value}.${propertyKey}` : `${value}['${propertyKey}']`;
|
|
148
193
|
const propertySchema = schema.properties[propertyKey];
|
|
149
194
|
if (schema.required && schema.required.includes(propertyKey)) {
|
|
150
195
|
yield* Visit(propertySchema, memberExpression);
|
|
@@ -231,52 +276,71 @@ var TypeCompiler;
|
|
|
231
276
|
yield `(${name}(${value}))`;
|
|
232
277
|
return;
|
|
233
278
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
if (index_2.TypeGuard.TAny(schema)) {
|
|
280
|
+
return yield* Any(schema, value);
|
|
281
|
+
}
|
|
282
|
+
else if (index_2.TypeGuard.TArray(schema)) {
|
|
283
|
+
return yield* Array(schema, value);
|
|
284
|
+
}
|
|
285
|
+
else if (index_2.TypeGuard.TBoolean(schema)) {
|
|
286
|
+
return yield* Boolean(schema, value);
|
|
287
|
+
}
|
|
288
|
+
else if (index_2.TypeGuard.TConstructor(schema)) {
|
|
289
|
+
return yield* Constructor(schema, value);
|
|
290
|
+
}
|
|
291
|
+
else if (index_2.TypeGuard.TFunction(schema)) {
|
|
292
|
+
return yield* Function(schema, value);
|
|
293
|
+
}
|
|
294
|
+
else if (index_2.TypeGuard.TInteger(schema)) {
|
|
295
|
+
return yield* Integer(schema, value);
|
|
296
|
+
}
|
|
297
|
+
else if (index_2.TypeGuard.TLiteral(schema)) {
|
|
298
|
+
return yield* Literal(schema, value);
|
|
299
|
+
}
|
|
300
|
+
else if (index_2.TypeGuard.TNull(schema)) {
|
|
301
|
+
return yield* Null(schema, value);
|
|
302
|
+
}
|
|
303
|
+
else if (index_2.TypeGuard.TNumber(schema)) {
|
|
304
|
+
return yield* Number(schema, value);
|
|
305
|
+
}
|
|
306
|
+
else if (index_2.TypeGuard.TObject(schema)) {
|
|
307
|
+
return yield* Object(schema, value);
|
|
308
|
+
}
|
|
309
|
+
else if (index_2.TypeGuard.TPromise(schema)) {
|
|
310
|
+
return yield* Promise(schema, value);
|
|
311
|
+
}
|
|
312
|
+
else if (index_2.TypeGuard.TRecord(schema)) {
|
|
313
|
+
return yield* Record(schema, value);
|
|
314
|
+
}
|
|
315
|
+
else if (index_2.TypeGuard.TRef(schema)) {
|
|
316
|
+
return yield* Ref(schema, value);
|
|
317
|
+
}
|
|
318
|
+
else if (index_2.TypeGuard.TSelf(schema)) {
|
|
319
|
+
return yield* Self(schema, value);
|
|
320
|
+
}
|
|
321
|
+
else if (index_2.TypeGuard.TString(schema)) {
|
|
322
|
+
return yield* String(schema, value);
|
|
323
|
+
}
|
|
324
|
+
else if (index_2.TypeGuard.TTuple(schema)) {
|
|
325
|
+
return yield* Tuple(schema, value);
|
|
326
|
+
}
|
|
327
|
+
else if (index_2.TypeGuard.TUndefined(schema)) {
|
|
328
|
+
return yield* Undefined(schema, value);
|
|
329
|
+
}
|
|
330
|
+
else if (index_2.TypeGuard.TUnion(schema)) {
|
|
331
|
+
return yield* Union(schema, value);
|
|
332
|
+
}
|
|
333
|
+
else if (index_2.TypeGuard.TUint8Array(schema)) {
|
|
334
|
+
return yield* Uint8Array(schema, value);
|
|
335
|
+
}
|
|
336
|
+
else if (index_2.TypeGuard.TUnknown(schema)) {
|
|
337
|
+
return yield* Unknown(schema, value);
|
|
338
|
+
}
|
|
339
|
+
else if (index_2.TypeGuard.TVoid(schema)) {
|
|
340
|
+
return yield* Void(schema, value);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
throw new TypeCompilerInvalidTypeError(schema);
|
|
280
344
|
}
|
|
281
345
|
}
|
|
282
346
|
// -------------------------------------------------------------------
|
package/compiler/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ValueError, ValueErrorType } from '../
|
|
1
|
+
export { ValueError, ValueErrorType } from '../errors/index';
|
|
2
2
|
export * from './compiler';
|
package/compiler/index.js
CHANGED
|
@@ -42,6 +42,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
44
|
exports.ValueErrorType = void 0;
|
|
45
|
-
var
|
|
46
|
-
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return
|
|
45
|
+
var index_1 = require("../errors/index");
|
|
46
|
+
Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } });
|
|
47
47
|
__exportStar(require("./compiler"), exports);
|
|
@@ -47,6 +47,10 @@ export interface ValueError {
|
|
|
47
47
|
value: unknown;
|
|
48
48
|
message: string;
|
|
49
49
|
}
|
|
50
|
+
export declare class ValueErrorsInvalidTypeError extends Error {
|
|
51
|
+
readonly schema: Types.TSchema;
|
|
52
|
+
constructor(schema: Types.TSchema);
|
|
53
|
+
}
|
|
50
54
|
export declare namespace ValueErrors {
|
|
51
55
|
function Errors<T extends Types.TSchema>(schema: T, references: Types.TSchema[], value: any): IterableIterator<ValueError>;
|
|
52
56
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*--------------------------------------------------------------------------
|
|
3
3
|
|
|
4
|
-
@sinclair/typebox/
|
|
4
|
+
@sinclair/typebox/errors
|
|
5
5
|
|
|
6
6
|
The MIT License (MIT)
|
|
7
7
|
|
|
@@ -27,8 +27,8 @@ THE SOFTWARE.
|
|
|
27
27
|
|
|
28
28
|
---------------------------------------------------------------------------*/
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.ValueErrors = exports.ValueErrorType = void 0;
|
|
31
|
-
const
|
|
30
|
+
exports.ValueErrors = exports.ValueErrorsInvalidTypeError = exports.ValueErrorType = void 0;
|
|
31
|
+
const index_1 = require("../guard/index");
|
|
32
32
|
// -------------------------------------------------------------------
|
|
33
33
|
// ValueErrorType
|
|
34
34
|
// -------------------------------------------------------------------
|
|
@@ -77,6 +77,13 @@ var ValueErrorType;
|
|
|
77
77
|
// -------------------------------------------------------------------
|
|
78
78
|
// ValueErrors
|
|
79
79
|
// -------------------------------------------------------------------
|
|
80
|
+
class ValueErrorsInvalidTypeError extends Error {
|
|
81
|
+
constructor(schema) {
|
|
82
|
+
super('ValueErrors: Invalid type');
|
|
83
|
+
this.schema = schema;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.ValueErrorsInvalidTypeError = ValueErrorsInvalidTypeError;
|
|
80
87
|
var ValueErrors;
|
|
81
88
|
(function (ValueErrors) {
|
|
82
89
|
function* Any(schema, references, path, value) { }
|
|
@@ -103,7 +110,7 @@ var ValueErrors;
|
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
function* Constructor(schema, references, path, value) {
|
|
106
|
-
yield* Visit(schema.returns, references, path, value);
|
|
113
|
+
yield* Visit(schema.returns, references, path, value.prototype);
|
|
107
114
|
}
|
|
108
115
|
function* Function(schema, references, path, value) {
|
|
109
116
|
if (!(typeof value === 'function')) {
|
|
@@ -299,53 +306,72 @@ var ValueErrors;
|
|
|
299
306
|
}
|
|
300
307
|
}
|
|
301
308
|
function* Visit(schema, references, path, value) {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
309
|
+
const refs = schema.$id === undefined ? references : [schema, ...references];
|
|
310
|
+
if (index_1.TypeGuard.TAny(schema)) {
|
|
311
|
+
return yield* Any(schema, refs, path, value);
|
|
312
|
+
}
|
|
313
|
+
else if (index_1.TypeGuard.TArray(schema)) {
|
|
314
|
+
return yield* Array(schema, refs, path, value);
|
|
315
|
+
}
|
|
316
|
+
else if (index_1.TypeGuard.TBoolean(schema)) {
|
|
317
|
+
return yield* Boolean(schema, refs, path, value);
|
|
318
|
+
}
|
|
319
|
+
else if (index_1.TypeGuard.TConstructor(schema)) {
|
|
320
|
+
return yield* Constructor(schema, refs, path, value);
|
|
321
|
+
}
|
|
322
|
+
else if (index_1.TypeGuard.TFunction(schema)) {
|
|
323
|
+
return yield* Function(schema, refs, path, value);
|
|
324
|
+
}
|
|
325
|
+
else if (index_1.TypeGuard.TInteger(schema)) {
|
|
326
|
+
return yield* Integer(schema, refs, path, value);
|
|
327
|
+
}
|
|
328
|
+
else if (index_1.TypeGuard.TLiteral(schema)) {
|
|
329
|
+
return yield* Literal(schema, refs, path, value);
|
|
330
|
+
}
|
|
331
|
+
else if (index_1.TypeGuard.TNull(schema)) {
|
|
332
|
+
return yield* Null(schema, refs, path, value);
|
|
333
|
+
}
|
|
334
|
+
else if (index_1.TypeGuard.TNumber(schema)) {
|
|
335
|
+
return yield* Number(schema, refs, path, value);
|
|
336
|
+
}
|
|
337
|
+
else if (index_1.TypeGuard.TObject(schema)) {
|
|
338
|
+
return yield* Object(schema, refs, path, value);
|
|
339
|
+
}
|
|
340
|
+
else if (index_1.TypeGuard.TPromise(schema)) {
|
|
341
|
+
return yield* Promise(schema, refs, path, value);
|
|
342
|
+
}
|
|
343
|
+
else if (index_1.TypeGuard.TRecord(schema)) {
|
|
344
|
+
return yield* Record(schema, refs, path, value);
|
|
345
|
+
}
|
|
346
|
+
else if (index_1.TypeGuard.TRef(schema)) {
|
|
347
|
+
return yield* Ref(schema, refs, path, value);
|
|
348
|
+
}
|
|
349
|
+
else if (index_1.TypeGuard.TSelf(schema)) {
|
|
350
|
+
return yield* Self(schema, refs, path, value);
|
|
351
|
+
}
|
|
352
|
+
else if (index_1.TypeGuard.TString(schema)) {
|
|
353
|
+
return yield* String(schema, refs, path, value);
|
|
354
|
+
}
|
|
355
|
+
else if (index_1.TypeGuard.TTuple(schema)) {
|
|
356
|
+
return yield* Tuple(schema, refs, path, value);
|
|
357
|
+
}
|
|
358
|
+
else if (index_1.TypeGuard.TUndefined(schema)) {
|
|
359
|
+
return yield* Undefined(schema, refs, path, value);
|
|
360
|
+
}
|
|
361
|
+
else if (index_1.TypeGuard.TUnion(schema)) {
|
|
362
|
+
return yield* Union(schema, refs, path, value);
|
|
363
|
+
}
|
|
364
|
+
else if (index_1.TypeGuard.TUint8Array(schema)) {
|
|
365
|
+
return yield* Uint8Array(schema, refs, path, value);
|
|
366
|
+
}
|
|
367
|
+
else if (index_1.TypeGuard.TUnknown(schema)) {
|
|
368
|
+
return yield* Unknown(schema, refs, path, value);
|
|
369
|
+
}
|
|
370
|
+
else if (index_1.TypeGuard.TVoid(schema)) {
|
|
371
|
+
return yield* Void(schema, refs, path, value);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
throw new ValueErrorsInvalidTypeError(schema);
|
|
349
375
|
}
|
|
350
376
|
}
|
|
351
377
|
function* Errors(schema, references, value) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './errors';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*--------------------------------------------------------------------------
|
|
3
3
|
|
|
4
|
-
@sinclair/typebox/
|
|
4
|
+
@sinclair/typebox/errors
|
|
5
5
|
|
|
6
6
|
The MIT License (MIT)
|
|
7
7
|
|
|
@@ -26,39 +26,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
26
26
|
THE SOFTWARE.
|
|
27
27
|
|
|
28
28
|
---------------------------------------------------------------------------*/
|
|
29
|
-
Object.
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
return char === 36;
|
|
35
|
-
}
|
|
36
|
-
function Underscore(char) {
|
|
37
|
-
return char === 95;
|
|
38
|
-
}
|
|
39
|
-
function Numeric(char) {
|
|
40
|
-
return char >= 48 && char <= 57;
|
|
29
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
33
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
41
34
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
for (let i = 1; i < propertyName.length; i++) {
|
|
56
|
-
const code = propertyName.charCodeAt(i);
|
|
57
|
-
if (!(DollarSign(code) || Underscore(code) || Alpha(code) || Numeric(code))) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
Property.Check = Check;
|
|
64
|
-
})(Property = exports.Property || (exports.Property = {}));
|
|
35
|
+
Object.defineProperty(o, k2, desc);
|
|
36
|
+
}) : (function(o, m, k, k2) {
|
|
37
|
+
if (k2 === undefined) k2 = k;
|
|
38
|
+
o[k2] = m[k];
|
|
39
|
+
}));
|
|
40
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
41
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
__exportStar(require("./errors"), exports);
|