json2dart-generator 1.0.1 → 1.0.2
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/dist/core/json2dart.d.ts +1 -1
- package/dist/core/json2dart.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/core/json2dart.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function jsonToDart(value: any, className: string, suffix: string, nullSafety: boolean, numparse: boolean): string;
|
|
1
|
+
export declare function jsonToDart(value: any, className: string, suffix: string, nullSafety: boolean, numparse: boolean, isRoot?: boolean): string;
|
package/dist/core/json2dart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';const a0_0x5ddc03=a0_0x1405;(function(_0x16f01e,_0x5c125b){const _0x9d99d2=a0_0x1405,_0x12fb9e=_0x16f01e();while(!![]){try{const _0x1ed970=parseInt(_0x9d99d2(0x205))/0x1*(-parseInt(_0x9d99d2(0x212))/0x2)+-parseInt(_0x9d99d2(0x222))/0x3+parseInt(_0x9d99d2(0x1f8))/0x4+-parseInt(_0x9d99d2(0x1e8))/0x5*(parseInt(_0x9d99d2(0x229))/0x6)+-parseInt(_0x9d99d2(0x1f2))/0x7*(-parseInt(_0x9d99d2(0x22f))/0x8)+parseInt(_0x9d99d2(0x23c))/0x9+-parseInt(_0x9d99d2(0x234))/0xa;if(_0x1ed970===_0x5c125b)break;else _0x12fb9e['push'](_0x12fb9e['shift']());}catch(_0x41a588){_0x12fb9e['push'](_0x12fb9e['shift']());}}}(a0_0x5752,0xa77f1));function a0_0x1405(_0x35232f,_0x5a87a7){_0x35232f=_0x35232f-0x1e6;const _0x575225=a0_0x5752();let _0x140589=_0x575225[_0x35232f];return _0x140589;}Object[a0_0x5ddc03(0x232)](exports,'__esModule',{'value':!![]}),exports['jsonToDart']=jsonToDart;const js_utils_plus_1=require(a0_0x5ddc03(0x226));function a0_0x5752(){const _0x2ebb58=['case','isString','53525leXieN','({\x0a','await','\x20\x20\x20\x20this.','yield','finally','?.toJson()','part','bool','typedef','56zwKEuX','dynamic','test','\x20\x20Map<String,\x20dynamic>\x20toJson()\x20=>\x20{\x0a','throw','isObject','4897620glNsBf','show','double.tryParse(','isNumber','\x20\x20\x20\x20','?.toString()\x20??\x20\x27\x27)','?.map((e)\x20=>\x20','implements','?.toString()','\x20=\x20','double','deferred','num','439htsytj','-\x20警告!:','new','isBoolean','try','Function','the','for','final','get','join','external','default','3896ciSIAc','hide','interface','factory','List<','log','isArray','var','assert','uppercaseFirst','String','covariant','json?[','else','class','int','3642045xdZKbI','\x20类包含值为\x22空\x22的属性,将被默认视为”String“类型','push','while','js-utils-plus','extends','snakeToCamel','18eNuxqS','entries','\x20as\x20bool?','library','\x20\x20}','includes','1253992xNKmyg','\x20as\x20List<dynamic>?)?.map((e)\x20=>\x20','\x20as\x20Map<String,\x20dynamic>?)','defineProperty','\x20\x20};','9908220vRBJXF','.fromJson(',').toList()','.fromJson(Map<String,\x20dynamic>?\x20json)\x20{\x0a','rethrow','switch','enum','mixin','11698128WLYqMT','const','replace'];a0_0x5752=function(){return _0x2ebb58;};return a0_0x5752();}function modelTypeGenerator(_0x1e272a,_0x1b6a05,_0x224b39,_0x33ed8c,_0x3332e2){const _0x5dd8a4=a0_0x5ddc03;if((0x0,js_utils_plus_1[_0x5dd8a4(0x208)])(_0x1e272a))return{'type':_0x5dd8a4(0x1f0),'typeTo':_0x50048b=>_0x50048b,'typeFrom':_0x1f2f02=>_0x1f2f02+_0x5dd8a4(0x22b)};if((0x0,js_utils_plus_1[_0x5dd8a4(0x1e7)])(_0x1e272a))return{'type':'String','typeTo':_0x1801d4=>_0x1801d4,'typeFrom':_0x450a53=>_0x450a53+_0x5dd8a4(0x200)};if((0x0,js_utils_plus_1[_0x5dd8a4(0x1fb)])(_0x1e272a)){if(_0x3332e2)return{'type':_0x5dd8a4(0x204),'typeTo':_0x5cf24c=>_0x5cf24c,'typeFrom':_0x2d00ec=>'num.tryParse('+_0x2d00ec+_0x5dd8a4(0x1fd)};return(0x0,js_utils_plus_1['isInt'])(_0x1e272a)?{'type':_0x5dd8a4(0x221),'typeTo':_0x400d3e=>_0x400d3e,'typeFrom':_0x3b58b1=>'int.tryParse('+_0x3b58b1+_0x5dd8a4(0x1fd)}:{'type':'double','typeTo':_0x52a66c=>_0x52a66c,'typeFrom':_0xe08d6b=>_0x5dd8a4(0x1fa)+_0xe08d6b+'?.toString()\x20??\x20\x27\x27)'};}if((0x0,js_utils_plus_1[_0x5dd8a4(0x1f7)])(_0x1e272a))return{'type':''+_0x1b6a05+_0x224b39,'typeTo':_0x1e48fe=>_0x1e48fe+_0x5dd8a4(0x1ee),'typeFrom':_0x5e3c9a=>''+_0x1b6a05+_0x224b39+_0x5dd8a4(0x235)+_0x5e3c9a+_0x5dd8a4(0x231),'subLines':jsonToDart(_0x1e272a,_0x1b6a05,_0x224b39,_0x33ed8c,_0x3332e2,![])};if((0x0,js_utils_plus_1[_0x5dd8a4(0x218)])(_0x1e272a)){const _0x5ece22=_0x1e272a[0x0];if(!_0x5ece22)console[_0x5dd8a4(0x217)](_0x5dd8a4(0x206)+_0x1b6a05+_0x224b39+_0x5dd8a4(0x223));const {type:_0x31480d,typeTo:_0x5cc8ee,typeFrom:_0x5f2258,subLines:_0x53435c}=modelTypeGenerator(_0x5ece22||'',_0x1b6a05,_0x224b39,_0x33ed8c,_0x3332e2);return{'type':_0x5dd8a4(0x216)+_0x31480d+(_0x33ed8c?'?':'')+'>','typeTo':_0x546303=>_0x546303+_0x5dd8a4(0x1fe)+_0x5cc8ee('e')+_0x5dd8a4(0x236),'typeFrom':_0x36728d=>'('+_0x36728d+_0x5dd8a4(0x230)+_0x5f2258('e')+_0x5dd8a4(0x236),'subLines':_0x53435c};}return console[_0x5dd8a4(0x217)](_0x5dd8a4(0x206)+_0x1b6a05+_0x224b39+'\x20类包含值为\x22空\x22的属性,将被默认视为”String“类型'),{'type':_0x5dd8a4(0x21c),'typeTo':_0x5ca462=>_0x5ca462,'typeFrom':_0x21e140=>_0x21e140+'?.toString()'};}function modelKeywordDefence(_0x23e1b9){const _0x7fd6b0=a0_0x5ddc03;let _0x59112a=[_0x7fd6b0(0x204),_0x7fd6b0(0x202),_0x7fd6b0(0x221),_0x7fd6b0(0x21c),_0x7fd6b0(0x1f0),'List','abstract',_0x7fd6b0(0x1f3),_0x7fd6b0(0x1ff),_0x7fd6b0(0x1f9),'as',_0x7fd6b0(0x21f),'import','static',_0x7fd6b0(0x21a),_0x7fd6b0(0x23a),'in','super','async','export',_0x7fd6b0(0x214),_0x7fd6b0(0x239),_0x7fd6b0(0x1ea),_0x7fd6b0(0x227),'is','sync','break',_0x7fd6b0(0x210),_0x7fd6b0(0x22c),'this',_0x7fd6b0(0x1e6),_0x7fd6b0(0x215),_0x7fd6b0(0x23b),_0x7fd6b0(0x1f6),'catch','false',_0x7fd6b0(0x207),'true',_0x7fd6b0(0x220),_0x7fd6b0(0x20d),'null',_0x7fd6b0(0x209),_0x7fd6b0(0x23d),_0x7fd6b0(0x1ed),'on',_0x7fd6b0(0x1f1),'continue',_0x7fd6b0(0x20c),'operator',_0x7fd6b0(0x219),_0x7fd6b0(0x21d),_0x7fd6b0(0x20a),_0x7fd6b0(0x1ef),'void',_0x7fd6b0(0x211),_0x7fd6b0(0x20e),_0x7fd6b0(0x238),_0x7fd6b0(0x225),_0x7fd6b0(0x203),_0x7fd6b0(0x213),'return','with','do','if','set',_0x7fd6b0(0x1ec)];if(_0x59112a[_0x7fd6b0(0x22e)](_0x23e1b9)||/^\d/[_0x7fd6b0(0x1f4)](_0x23e1b9))return _0x7fd6b0(0x20b)+(0x0,js_utils_plus_1['uppercaseFirst'])(_0x23e1b9);return(0x0,js_utils_plus_1[_0x7fd6b0(0x228)])(_0x23e1b9);}let jsonClassMap={};function jsonToDart(_0x4366cc,_0x4b8130,_0x269aad,_0x113f1f,_0x30cf3a,_0x41e467=!![]){const _0x5d1a8c=a0_0x5ddc03;if(_0x41e467)jsonClassMap={};_0x4b8130=(0x0,js_utils_plus_1[_0x5d1a8c(0x21b)])((0x0,js_utils_plus_1[_0x5d1a8c(0x228)])(_0x4b8130));let _0xdc1974=[],_0x329403=[],_0x2730f1=[],_0x2d5343=[],_0x167255=[],_0x37e62d=[],_0x430f12='';_0xdc1974[_0x5d1a8c(0x224)]('class\x20'+_0x4b8130+_0x269aad+'\x20{'),_0x2730f1['push']('\x20\x20'+_0x4b8130+_0x269aad+_0x5d1a8c(0x1e9)),_0x2d5343[_0x5d1a8c(0x224)]('\x20\x20'+_0x4b8130+_0x269aad+_0x5d1a8c(0x237)),_0x167255[_0x5d1a8c(0x224)](_0x5d1a8c(0x1f5));for(const [_0x53902c,_0xe4e6c1]of Object[_0x5d1a8c(0x22a)](_0x4366cc)){let _0x4ca3e7='\x27'+_0x53902c+'\x27',_0x5466ba=modelKeywordDefence(_0x53902c);const _0x1cdb9c=(0x0,js_utils_plus_1[_0x5d1a8c(0x21b)])((0x0,js_utils_plus_1[_0x5d1a8c(0x228)])(_0x53902c)),{type:_0x1a4a22,typeTo:_0x2e047b,typeFrom:_0x5bca25,subLines:_0x1f24f8}=modelTypeGenerator(_0xe4e6c1,_0x1cdb9c,_0x269aad,_0x113f1f,_0x30cf3a);if(_0x1f24f8)_0x37e62d['push'](_0x1f24f8);_0x2730f1['push'](_0x5d1a8c(0x1eb)+_0x5466ba+',\x0a'),_0x329403[_0x5d1a8c(0x224)]('\x20\x20'+_0x1a4a22+(_0x113f1f?'?':'')+'\x20'+_0x5466ba+';\x0a'),_0x2d5343[_0x5d1a8c(0x224)]('\x20\x20\x20\x20'+_0x5466ba+_0x5d1a8c(0x201)+_0x5bca25(_0x5d1a8c(0x21e)+_0x4ca3e7+']')+';\x0a'),_0x167255[_0x5d1a8c(0x224)](_0x5d1a8c(0x1fc)+_0x4ca3e7+':\x20'+_0x2e047b(_0x5466ba)+',\x0a'),_0x430f12+=_0x53902c+'='+_0x1a4a22;}if(jsonClassMap[_0x4b8130]&&jsonClassMap[_0x4b8130]==_0x430f12)return'';return jsonClassMap[_0x4b8130]=_0x430f12,_0x2730f1[_0x5d1a8c(0x224)]('\x20\x20});'),_0x2d5343[_0x5d1a8c(0x224)](_0x5d1a8c(0x22d)),_0x167255[_0x5d1a8c(0x224)](_0x5d1a8c(0x233)),_0xdc1974[_0x5d1a8c(0x224)](_0x329403[_0x5d1a8c(0x20f)]('')),_0xdc1974[_0x5d1a8c(0x224)](_0x2730f1[_0x5d1a8c(0x20f)]('')),_0xdc1974[_0x5d1a8c(0x224)](_0x2d5343[_0x5d1a8c(0x20f)]('')),_0xdc1974[_0x5d1a8c(0x224)](_0x167255[_0x5d1a8c(0x20f)]('')),_0xdc1974[_0x5d1a8c(0x224)]('}\x0a'),_0xdc1974[_0x5d1a8c(0x224)](_0x37e62d['join']('')),_0x41e467?_0xdc1974['join']('\x0a')[_0x5d1a8c(0x23e)](/[\n\r]?$/g,''):_0xdc1974['join']('\x0a');}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
'use strict';const
|
|
2
|
+
'use strict';const a1_0xff66c6=a1_0x15ca;(function(_0x1ef85c,_0x4b800d){const _0x5e8342=a1_0x15ca,_0x454417=_0x1ef85c();while(!![]){try{const _0x3c41cd=-parseInt(_0x5e8342(0x1a9))/0x1*(parseInt(_0x5e8342(0x1c1))/0x2)+-parseInt(_0x5e8342(0x1b8))/0x3*(-parseInt(_0x5e8342(0x1b7))/0x4)+-parseInt(_0x5e8342(0x1c3))/0x5+-parseInt(_0x5e8342(0x19f))/0x6+-parseInt(_0x5e8342(0x1be))/0x7+-parseInt(_0x5e8342(0x1b9))/0x8+parseInt(_0x5e8342(0x19e))/0x9;if(_0x3c41cd===_0x4b800d)break;else _0x454417['push'](_0x454417['shift']());}catch(_0x7687bd){_0x454417['push'](_0x454417['shift']());}}}(a1_0x1c43,0x7d6f8));var __importDefault=this&&this[a1_0xff66c6(0x1a6)]||function(_0x4e40ef){const _0x98b063=a1_0xff66c6;return _0x4e40ef&&_0x4e40ef[_0x98b063(0x19c)]?_0x4e40ef:{'default':_0x4e40ef};};function a1_0x15ca(_0x2b031f,_0x1d8888){_0x2b031f=_0x2b031f-0x19b;const _0x1c433e=a1_0x1c43();let _0x15ca1f=_0x1c433e[_0x2b031f];return _0x15ca1f;}Object[a1_0xff66c6(0x1af)](exports,a1_0xff66c6(0x19c),{'value':!![]});const json2dart_1=require(a1_0xff66c6(0x1b3)),js_utils_plus_1=require(a1_0xff66c6(0x1b1)),commander_1=require(a1_0xff66c6(0x1c6)),path_1=__importDefault(require(a1_0xff66c6(0x1a8))),program=new commander_1[(a1_0xff66c6(0x1a2))](),_path=process[a1_0xff66c6(0x1bc)]();program[a1_0xff66c6(0x1a4)](a1_0xff66c6(0x1bd),'json文件夹路径,默认\x20.json_models/')['option'](a1_0xff66c6(0x1c0),'dart模型输出路径,默认\x20lib/models')[a1_0xff66c6(0x1a4)](a1_0xff66c6(0x1c2),'自定义dart模型类名后缀,\x20如\x20Entity、Model')[a1_0xff66c6(0x1a4)]('-e,\x20--excludes\x20<value...>',a1_0xff66c6(0x19b))[a1_0xff66c6(0x1a4)]('--numparse','使用num数据类型而不是double/int')['option'](a1_0xff66c6(0x1ad),'是否启用空安全'),program[a1_0xff66c6(0x1ab)]();const options=Object[a1_0xff66c6(0x19d)]({'dir':a1_0xff66c6(0x1b0),'output':a1_0xff66c6(0x1a5),'suffix':''},program[a1_0xff66c6(0x1a0)]());function run(){const _0x1899b6=a1_0xff66c6,_0x164db2=path_1[_0x1899b6(0x1c7)][_0x1899b6(0x1b4)](_path,options[_0x1899b6(0x1a7)]),_0x3a2b79=(0x0,js_utils_plus_1[_0x1899b6(0x1a3)])(_0x164db2,_0x1899b6(0x1ae),options['excludes']||[]);console[_0x1899b6(0x1ba)](new Array(0x50)[_0x1899b6(0x1b4)]('-')),_0x3a2b79[_0x1899b6(0x1aa)](function(_0x3ec96c){const _0x220bd6=_0x1899b6,_0x8c81c8=(0x0,js_utils_plus_1['readFileSync'])(_0x3ec96c,!![]);if(!_0x8c81c8){console[_0x220bd6(0x1c4)]('-\x20执行文件:'+_0x3ec96c);return;}console[_0x220bd6(0x1ba)]('-\x20执行文件:'+_0x3ec96c);const _0x2e1cab=path_1[_0x220bd6(0x1c7)]['parse'](_0x3ec96c);let _0x49d5a2=_0x8c81c8[_0x220bd6(0x1bb)]||_0x2e1cab[_0x220bd6(0x1ac)];if(_0x8c81c8[_0x220bd6(0x1bb)])delete _0x8c81c8[_0x220bd6(0x1bb)];const _0x29976a=(0x0,json2dart_1[_0x220bd6(0x1b2)])(_0x8c81c8,_0x49d5a2,options[_0x220bd6(0x1c5)],options[_0x220bd6(0x1b5)],options[_0x220bd6(0x1a1)]),_0x5a5e3d=path_1[_0x220bd6(0x1c7)][_0x220bd6(0x1b4)](_path,options[_0x220bd6(0x1bf)],_0x2e1cab[_0x220bd6(0x1ac)]+'.dart');(0x0,js_utils_plus_1[_0x220bd6(0x1b6)])(_0x5a5e3d,_0x29976a);});}function a1_0x1c43(){const _0x286884=['writeFileSync','3020BHCpdD','1527nQqnZK','2145808YdagXm','log','__className','cwd','-d,\x20--dir\x20<dir>','1233946baejxL','output','-o,\x20--output\x20<dir>','2158XWLsrS','-s,\x20--suffix\x20<value>','1003400Irlwwt','error','suffix','commander','default','需要排除的文件或文件夹,可指定多个文件','__esModule','assign','11376936WhuAgY','1389300bqPOyk','opts','numparse','Command','listFilesRecursively','option','lib/models','__importDefault','dir','path','239GeolzK','forEach','parse','name','--nullsafety','json','defineProperty','.json_models/','js-utils-plus','jsonToDart','./core/json2dart','join','nullsafety'];a1_0x1c43=function(){return _0x286884;};return a1_0x1c43();}run();
|