mol_conform 0.0.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/.nojekyll +0 -0
- package/README.md +41 -0
- package/node.audit.js +2 -0
- package/node.d.ts +30 -0
- package/node.d.ts.map +1 -0
- package/node.deps.json +1 -0
- package/node.js +128 -0
- package/node.js.map +1 -0
- package/node.meta.tree +18 -0
- package/node.mjs +129 -0
- package/node.test.js +4109 -0
- package/node.test.js.map +1 -0
- package/package.json +22 -0
- package/test.html +11 -0
- package/web.audit.js +2 -0
- package/web.css +1 -0
- package/web.css.map +1 -0
- package/web.d.ts +30 -0
- package/web.d.ts.map +1 -0
- package/web.deps.json +1 -0
- package/web.js +128 -0
- package/web.js.map +1 -0
- package/web.meta.tree +18 -0
- package/web.mjs +129 -0
- package/web.test.js +1398 -0
- package/web.test.js.map +1 -0
package/.nojekyll
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# $mol_conform
|
|
2
|
+
|
|
3
|
+
Conforms two data structures to one with reference uniqueness for different content.
|
|
4
|
+
This is same thing as React Reconciler but for any data.
|
|
5
|
+
|
|
6
|
+
## Usage example
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
|
|
10
|
+
class Point {
|
|
11
|
+
constructor( public x = 0 , public y = 0 ) {}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$mol_conform_handler( Point , ( target : Point , source : Point )=> {
|
|
15
|
+
if( target.x !== source.x ) return target
|
|
16
|
+
if( target.y !== source.y ) return target
|
|
17
|
+
return source
|
|
18
|
+
} )
|
|
19
|
+
|
|
20
|
+
const zero = new Point
|
|
21
|
+
const result = $mol_conform( target , source )
|
|
22
|
+
|
|
23
|
+
$mol_conform( [ new Point( 0 , 0 ) ] , [ zero ] ) // same as [ zero ]
|
|
24
|
+
$mol_conform( [ new Point( 0 , 1 ) ] , [ zero ] ) // not same as [ zero ]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
# API
|
|
28
|
+
|
|
29
|
+
**`$mol_conform( target : Target , source : Source ) : Target`**
|
|
30
|
+
|
|
31
|
+
Conforms structures.
|
|
32
|
+
|
|
33
|
+
**`$mol_conform_handler( cl : typeof Class , handler : ( target : Class , source : Class )=> Class )`**
|
|
34
|
+
|
|
35
|
+
Provides custom conforming function for class (not for subclasses).
|
|
36
|
+
|
|
37
|
+
## Supported by default types
|
|
38
|
+
|
|
39
|
+
- Primitives: `Undefined`, `Null`, `Boolean`, `Number`, `String`.
|
|
40
|
+
- POJO: `Object`, `Array`.
|
|
41
|
+
- Native value objects: `Date`, `RegExp`.
|
package/node.audit.js
ADDED
package/node.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare let _$_: {
|
|
2
|
+
new (): {};
|
|
3
|
+
} & typeof globalThis;
|
|
4
|
+
declare class $ extends _$_ {
|
|
5
|
+
}
|
|
6
|
+
declare namespace $ {
|
|
7
|
+
export type $ = typeof $$;
|
|
8
|
+
export class $$ extends $ {
|
|
9
|
+
}
|
|
10
|
+
namespace $$ {
|
|
11
|
+
type $$ = $;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare namespace $ {
|
|
17
|
+
const $mol_conform_stack: any[];
|
|
18
|
+
function $mol_conform<Target, Source>(target: Target, source: Source): Target;
|
|
19
|
+
const $mol_conform_handlers: WeakMap<Object, (target: any, source: any) => any>;
|
|
20
|
+
function $mol_conform_handler<Class>(cl: {
|
|
21
|
+
new (...args: any[]): Class;
|
|
22
|
+
}, handler: (target: Class, source: Class) => Class): void;
|
|
23
|
+
function $mol_conform_array<Value, List extends {
|
|
24
|
+
[index: number]: Value;
|
|
25
|
+
length: number;
|
|
26
|
+
}>(target: List, source: List): List;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export = $;
|
|
30
|
+
//# sourceMappingURL=node.d.ts.map
|
package/node.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../mam.d.ts","../conform.d.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourcesContent":[null,null]}
|
package/node.deps.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"files":["mam.ts","LICENSE","README.md","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","meta.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/conform/readme.md","mol/conform/conform.ts"],"mods":{},"deps_in":{"mol":{"mol/conform":-999},"":{"mol":-999}},"deps_out":{"mol/conform":{"mol":-999},"mol":{"":-999}},"sloc":{"ts":85,"LICENSE":113,"md":492,"js":9,"json":83,"tree":41,"CNAME":1},"deps":{"mol/conform":{"..":-999,"/mol/conform/stack":-1,"/mol/conform":-1,"/mol/conform/handlers/get":-2,"/mol/conform/stack/index/of":-2,"/mol/conform/stack/push":-2,"/mol/conform/stack/pop":-2,"/mol/conform/handlers":-1,"/mol/conform/handler":-1,"/mol/conform/handlers/set":-2,"/mol/conform/array":-1},"mol":{"..":-999},"":{}}}
|
package/node.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var exports = void 0;
|
|
4
|
+
|
|
5
|
+
var $node = $node || {}
|
|
6
|
+
void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
|
|
7
|
+
;
|
|
8
|
+
"use strict";
|
|
9
|
+
Error.stackTraceLimit = 50;
|
|
10
|
+
var $;
|
|
11
|
+
(function ($) {
|
|
12
|
+
})($ || ($ = {}));
|
|
13
|
+
module.exports = $;
|
|
14
|
+
|
|
15
|
+
;
|
|
16
|
+
|
|
17
|
+
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
18
|
+
;
|
|
19
|
+
"use strict"
|
|
20
|
+
|
|
21
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
22
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
24
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
25
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
29
|
+
$.$$ = $
|
|
30
|
+
|
|
31
|
+
;
|
|
32
|
+
"use strict";
|
|
33
|
+
var $;
|
|
34
|
+
(function ($) {
|
|
35
|
+
const cache = new WeakMap();
|
|
36
|
+
$.$mol_conform_stack = [];
|
|
37
|
+
function $mol_conform(target, source) {
|
|
38
|
+
if (Object.is(target, source))
|
|
39
|
+
return source;
|
|
40
|
+
if (!target || typeof target !== 'object')
|
|
41
|
+
return target;
|
|
42
|
+
if (!source || typeof source !== 'object')
|
|
43
|
+
return target;
|
|
44
|
+
if (target instanceof Error)
|
|
45
|
+
return target;
|
|
46
|
+
if (source instanceof Error)
|
|
47
|
+
return target;
|
|
48
|
+
if (target['constructor'] !== source['constructor'])
|
|
49
|
+
return target;
|
|
50
|
+
if (cache.get(target))
|
|
51
|
+
return target;
|
|
52
|
+
cache.set(target, true);
|
|
53
|
+
const conform = $.$mol_conform_handlers.get(target['constructor']);
|
|
54
|
+
if (!conform)
|
|
55
|
+
return target;
|
|
56
|
+
if ($.$mol_conform_stack.indexOf(target) !== -1)
|
|
57
|
+
return target;
|
|
58
|
+
$.$mol_conform_stack.push(target);
|
|
59
|
+
try {
|
|
60
|
+
return conform(target, source);
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
$.$mol_conform_stack.pop();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
$.$mol_conform = $mol_conform;
|
|
67
|
+
$.$mol_conform_handlers = new WeakMap();
|
|
68
|
+
function $mol_conform_handler(cl, handler) {
|
|
69
|
+
$.$mol_conform_handlers.set(cl, handler);
|
|
70
|
+
}
|
|
71
|
+
$.$mol_conform_handler = $mol_conform_handler;
|
|
72
|
+
function $mol_conform_array(target, source) {
|
|
73
|
+
if (source.length !== target.length)
|
|
74
|
+
return target;
|
|
75
|
+
for (let i = 0; i < target.length; ++i) {
|
|
76
|
+
if (!Object.is(source[i], target[i]))
|
|
77
|
+
return target;
|
|
78
|
+
}
|
|
79
|
+
return source;
|
|
80
|
+
}
|
|
81
|
+
$.$mol_conform_array = $mol_conform_array;
|
|
82
|
+
$mol_conform_handler(Array, $mol_conform_array);
|
|
83
|
+
$mol_conform_handler(Int8Array, $mol_conform_array);
|
|
84
|
+
$mol_conform_handler(Int16Array, $mol_conform_array);
|
|
85
|
+
$mol_conform_handler(Int32Array, $mol_conform_array);
|
|
86
|
+
$mol_conform_handler(BigInt64Array, $mol_conform_array);
|
|
87
|
+
$mol_conform_handler(Uint8Array, $mol_conform_array);
|
|
88
|
+
$mol_conform_handler(Uint16Array, $mol_conform_array);
|
|
89
|
+
$mol_conform_handler(Uint32Array, $mol_conform_array);
|
|
90
|
+
$mol_conform_handler(BigUint64Array, $mol_conform_array);
|
|
91
|
+
$mol_conform_handler(Float32Array, $mol_conform_array);
|
|
92
|
+
$mol_conform_handler(Float64Array, $mol_conform_array);
|
|
93
|
+
$mol_conform_handler(({})['constructor'], (target, source) => {
|
|
94
|
+
let count = 0;
|
|
95
|
+
let equal = true;
|
|
96
|
+
for (let key in target) {
|
|
97
|
+
const conformed = $mol_conform(target[key], source[key]);
|
|
98
|
+
if (conformed !== target[key]) {
|
|
99
|
+
try {
|
|
100
|
+
target[key] = conformed;
|
|
101
|
+
}
|
|
102
|
+
catch (error) { }
|
|
103
|
+
if (!Object.is(conformed, target[key]))
|
|
104
|
+
equal = false;
|
|
105
|
+
}
|
|
106
|
+
if (!Object.is(conformed, source[key]))
|
|
107
|
+
equal = false;
|
|
108
|
+
++count;
|
|
109
|
+
}
|
|
110
|
+
for (let key in source)
|
|
111
|
+
if (--count < 0)
|
|
112
|
+
break;
|
|
113
|
+
return (equal && count === 0) ? source : target;
|
|
114
|
+
});
|
|
115
|
+
$mol_conform_handler(Date, (target, source) => {
|
|
116
|
+
if (target.getTime() === source.getTime())
|
|
117
|
+
return source;
|
|
118
|
+
return target;
|
|
119
|
+
});
|
|
120
|
+
$mol_conform_handler(RegExp, (target, source) => {
|
|
121
|
+
if (target.toString() === source.toString())
|
|
122
|
+
return source;
|
|
123
|
+
return target;
|
|
124
|
+
});
|
|
125
|
+
})($ || ($ = {}));
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
//# sourceMappingURL=node.js.map
|
package/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["-","../../../mam.ts","../../../mol/conform/conform.ts"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;;;;;;;;;;;;;;AEFA,IAAU,CAAC,CA4GV;AA5GD,WAAU,CAAC;IAEV,MAAM,KAAK,GAAG,IAAI,OAAO,EAAmB,CAAA;IAE/B,oBAAkB,GAAG,EAAW,CAAA;IAE7C,SAAgB,YAAY,CAAqB,MAAe,EAAG,M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CAAA;IACd,CAAC,CAAE,CAAA;AAEJ,CAAC,EA5GS,CAAC,KAAD,CAAC,QA4GV;;","sourcesContent":[null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\n\tconst cache = new WeakMap< any , boolean >()\n\n\texport const $mol_conform_stack = [] as any[]\n\n\texport function $mol_conform< Target , Source >( target : Target , source : Source ) : Target {\n\n\t\tif( Object.is( target , source ) ) return source as any\n\n\t\tif( !target || typeof target !== 'object' ) return target\n\t\tif( !source || typeof source !== 'object' ) return target\n\n\t\tif( target instanceof Error ) return target\n\t\tif( source instanceof Error ) return target\n\t\t\n\t\tif( target['constructor'] !== source['constructor'] ) return target\n\n\t\tif( cache.get( target ) ) return target\n\t\tcache.set( target , true )\n\t\t\n\t\tconst conform = $mol_conform_handlers.get( target['constructor'] )\n\t\tif( !conform ) return target\n\n\t\tif( $mol_conform_stack.indexOf( target ) !== -1 ) return target\n\n\t\t$mol_conform_stack.push( target )\n\n\t\ttry { return conform( target , source ) }\n\t\tfinally { $mol_conform_stack.pop() }\n\n\t}\n\n\texport const $mol_conform_handlers = new WeakMap< Object , ( target : any , source : any )=> any >()\n\n\texport function $mol_conform_handler< Class >(\n\t\tcl : { new( ... args : any[] ) : Class } ,\n\t\thandler : ( target : Class , source : Class )=> Class ,\n\t) {\n\t\t$mol_conform_handlers.set( cl , handler )\n\t}\n\n\texport function $mol_conform_array<\n\t\tValue ,\n\t\tList extends {\n\t\t\t[ index : number ] : Value\n\t\t\tlength : number\n\t\t} ,\n\t>( target : List , source : List ) {\n\t\t\n\t\tif( source.length !== target.length ) return target\n\t\t\n\t\tfor( let i = 0 ; i < target.length ; ++i ) {\n\t\t\tif( !Object.is( source[i] , target[i] ) ) return target\n\t\t}\n\n\t\treturn source\n\t}\n\n\t$mol_conform_handler( Array , $mol_conform_array )\n\t\n\t$mol_conform_handler( Int8Array , $mol_conform_array )\n\t$mol_conform_handler( Int16Array , $mol_conform_array )\n\t$mol_conform_handler( Int32Array , $mol_conform_array )\n\t$mol_conform_handler( BigInt64Array , $mol_conform_array )\n\t\n\t$mol_conform_handler( Uint8Array , $mol_conform_array )\n\t$mol_conform_handler( Uint16Array , $mol_conform_array )\n\t$mol_conform_handler( Uint32Array , $mol_conform_array )\n\t$mol_conform_handler( BigUint64Array , $mol_conform_array )\n\n\t$mol_conform_handler( Float32Array , $mol_conform_array )\n\t$mol_conform_handler( Float64Array , $mol_conform_array )\n\n\t$mol_conform_handler( ({})['constructor'] as any , ( target: Object, source )=> {\n\n\t\tlet count = 0\n\t\tlet equal = true\n\n\t\tfor( let key in target ) {\n\n\t\t\tconst conformed = $mol_conform( target[ key as never ] , source[ key as never ] )\n\t\t\t\n\t\t\tif( conformed !== target[ key as never ] ) {\n\t\t\t\ttry { target[ key as never ] = conformed } catch( error: any ) {}\n\t\t\t\tif( !Object.is( conformed , target[ key as never ] ) ) equal = false\n\t\t\t}\n\t\t\t\n\t\t\tif( !Object.is( conformed , source[ key as never ] ) ) equal = false\n\t\t\t\n\t\t\t++ count\n\t\t}\n\n\t\tfor( let key in source ) if( -- count < 0 ) break\n\n\t\treturn ( equal && count === 0 ) ? source : target\n\t} )\n\n\t$mol_conform_handler( Date , ( target , source )=> {\n\t\tif( target.getTime() === source.getTime() ) return source\n\t\treturn target \n\t} )\n\n\t$mol_conform_handler( RegExp , ( target , source )=> {\n\t\tif( target.toString() === source.toString() ) return source\n\t\treturn target\n\t} )\n\n}\n"]}
|
package/node.meta.tree
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
\/
|
|
2
|
+
pack bun git \https://github.com/spleekz/mam_bun.git
|
|
3
|
+
pack hyoo git \https://github.com/hyoo-ru/mam_hyoo.git
|
|
4
|
+
pack iva git \https://github.com/thenesterov/mam_iva.git
|
|
5
|
+
pack jin git \https://github.com/nin-jin/mam_jin.git
|
|
6
|
+
pack lib git \https://github.com/hyoo-ru/mam_lib.git
|
|
7
|
+
pack mol git \https://github.com/hyoo-ru/mam_mol.git
|
|
8
|
+
pack milis git \https://github.com/Lyumih/milis.git
|
|
9
|
+
pack mpds git \https://github.com/mpds-io/mam_mpds.git
|
|
10
|
+
pack node git \https://github.com/hyoo-ru/mam_node.git
|
|
11
|
+
pack optimade git \https://github.com/mpds-io/mam_optimade.git
|
|
12
|
+
pack piterjs git \https://github.com/piterjs/piterjs.git
|
|
13
|
+
pack psb git \https://github.com/MolDevHack/psb.git
|
|
14
|
+
pack rise git \https://github.com/stan-donarise/mam_rise.git
|
|
15
|
+
pack yuf git \https://github.com/zerkalica/yuf.git
|
|
16
|
+
pack apxu git \https://github.com/ApxuTechTop/apxu
|
|
17
|
+
\/mol
|
|
18
|
+
pack icon git \https://github.com/nin-jin/mol_icon.git
|
package/node.mjs
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var exports = void 0;
|
|
4
|
+
|
|
5
|
+
var $node = $node || {}
|
|
6
|
+
void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
|
|
7
|
+
;
|
|
8
|
+
"use strict";
|
|
9
|
+
Error.stackTraceLimit = 50;
|
|
10
|
+
var $;
|
|
11
|
+
(function ($) {
|
|
12
|
+
})($ || ($ = {}));
|
|
13
|
+
module.exports = $;
|
|
14
|
+
|
|
15
|
+
;
|
|
16
|
+
|
|
17
|
+
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
18
|
+
;
|
|
19
|
+
"use strict"
|
|
20
|
+
|
|
21
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
22
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
24
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
25
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
29
|
+
$.$$ = $
|
|
30
|
+
|
|
31
|
+
;
|
|
32
|
+
"use strict";
|
|
33
|
+
var $;
|
|
34
|
+
(function ($) {
|
|
35
|
+
const cache = new WeakMap();
|
|
36
|
+
$.$mol_conform_stack = [];
|
|
37
|
+
function $mol_conform(target, source) {
|
|
38
|
+
if (Object.is(target, source))
|
|
39
|
+
return source;
|
|
40
|
+
if (!target || typeof target !== 'object')
|
|
41
|
+
return target;
|
|
42
|
+
if (!source || typeof source !== 'object')
|
|
43
|
+
return target;
|
|
44
|
+
if (target instanceof Error)
|
|
45
|
+
return target;
|
|
46
|
+
if (source instanceof Error)
|
|
47
|
+
return target;
|
|
48
|
+
if (target['constructor'] !== source['constructor'])
|
|
49
|
+
return target;
|
|
50
|
+
if (cache.get(target))
|
|
51
|
+
return target;
|
|
52
|
+
cache.set(target, true);
|
|
53
|
+
const conform = $.$mol_conform_handlers.get(target['constructor']);
|
|
54
|
+
if (!conform)
|
|
55
|
+
return target;
|
|
56
|
+
if ($.$mol_conform_stack.indexOf(target) !== -1)
|
|
57
|
+
return target;
|
|
58
|
+
$.$mol_conform_stack.push(target);
|
|
59
|
+
try {
|
|
60
|
+
return conform(target, source);
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
$.$mol_conform_stack.pop();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
$.$mol_conform = $mol_conform;
|
|
67
|
+
$.$mol_conform_handlers = new WeakMap();
|
|
68
|
+
function $mol_conform_handler(cl, handler) {
|
|
69
|
+
$.$mol_conform_handlers.set(cl, handler);
|
|
70
|
+
}
|
|
71
|
+
$.$mol_conform_handler = $mol_conform_handler;
|
|
72
|
+
function $mol_conform_array(target, source) {
|
|
73
|
+
if (source.length !== target.length)
|
|
74
|
+
return target;
|
|
75
|
+
for (let i = 0; i < target.length; ++i) {
|
|
76
|
+
if (!Object.is(source[i], target[i]))
|
|
77
|
+
return target;
|
|
78
|
+
}
|
|
79
|
+
return source;
|
|
80
|
+
}
|
|
81
|
+
$.$mol_conform_array = $mol_conform_array;
|
|
82
|
+
$mol_conform_handler(Array, $mol_conform_array);
|
|
83
|
+
$mol_conform_handler(Int8Array, $mol_conform_array);
|
|
84
|
+
$mol_conform_handler(Int16Array, $mol_conform_array);
|
|
85
|
+
$mol_conform_handler(Int32Array, $mol_conform_array);
|
|
86
|
+
$mol_conform_handler(BigInt64Array, $mol_conform_array);
|
|
87
|
+
$mol_conform_handler(Uint8Array, $mol_conform_array);
|
|
88
|
+
$mol_conform_handler(Uint16Array, $mol_conform_array);
|
|
89
|
+
$mol_conform_handler(Uint32Array, $mol_conform_array);
|
|
90
|
+
$mol_conform_handler(BigUint64Array, $mol_conform_array);
|
|
91
|
+
$mol_conform_handler(Float32Array, $mol_conform_array);
|
|
92
|
+
$mol_conform_handler(Float64Array, $mol_conform_array);
|
|
93
|
+
$mol_conform_handler(({})['constructor'], (target, source) => {
|
|
94
|
+
let count = 0;
|
|
95
|
+
let equal = true;
|
|
96
|
+
for (let key in target) {
|
|
97
|
+
const conformed = $mol_conform(target[key], source[key]);
|
|
98
|
+
if (conformed !== target[key]) {
|
|
99
|
+
try {
|
|
100
|
+
target[key] = conformed;
|
|
101
|
+
}
|
|
102
|
+
catch (error) { }
|
|
103
|
+
if (!Object.is(conformed, target[key]))
|
|
104
|
+
equal = false;
|
|
105
|
+
}
|
|
106
|
+
if (!Object.is(conformed, source[key]))
|
|
107
|
+
equal = false;
|
|
108
|
+
++count;
|
|
109
|
+
}
|
|
110
|
+
for (let key in source)
|
|
111
|
+
if (--count < 0)
|
|
112
|
+
break;
|
|
113
|
+
return (equal && count === 0) ? source : target;
|
|
114
|
+
});
|
|
115
|
+
$mol_conform_handler(Date, (target, source) => {
|
|
116
|
+
if (target.getTime() === source.getTime())
|
|
117
|
+
return source;
|
|
118
|
+
return target;
|
|
119
|
+
});
|
|
120
|
+
$mol_conform_handler(RegExp, (target, source) => {
|
|
121
|
+
if (target.toString() === source.toString())
|
|
122
|
+
return source;
|
|
123
|
+
return target;
|
|
124
|
+
});
|
|
125
|
+
})($ || ($ = {}));
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
export default $
|
|
129
|
+
//# sourceMappingURL=node.js.map
|