1 line
8.4 KiB
JSON
1 line
8.4 KiB
JSON
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar SPLIT = '__@field_split__';\n\n/**\n * Convert name path into string to fast the fetch speed of Map.\n */\nfunction normalize(namePath) {\n return namePath.map(function (cell) {\n return \"\".concat(_typeof(cell), \":\").concat(cell);\n })\n // Magic split\n .join(SPLIT);\n}\n\n/**\n * NameMap like a `Map` but accepts `string[]` as key.\n */\nvar NameMap = /*#__PURE__*/function () {\n function NameMap() {\n _classCallCheck(this, NameMap);\n _defineProperty(this, \"kvs\", new Map());\n }\n _createClass(NameMap, [{\n key: \"set\",\n value: function set(key, value) {\n this.kvs.set(normalize(key), value);\n }\n }, {\n key: \"get\",\n value: function get(key) {\n return this.kvs.get(normalize(key));\n }\n }, {\n key: \"update\",\n value: function update(key, updater) {\n var origin = this.get(key);\n var next = updater(origin);\n if (!next) {\n this.delete(key);\n } else {\n this.set(key, next);\n }\n }\n }, {\n key: \"delete\",\n value: function _delete(key) {\n this.kvs.delete(normalize(key));\n }\n\n // Since we only use this in test, let simply realize this\n }, {\n key: \"map\",\n value: function map(callback) {\n return _toConsumableArray(this.kvs.entries()).map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n var cells = key.split(SPLIT);\n return callback({\n key: cells.map(function (cell) {\n var _cell$match = cell.match(/^([^:]*):(.*)$/),\n _cell$match2 = _slicedToArray(_cell$match, 3),\n type = _cell$match2[1],\n unit = _cell$match2[2];\n return type === 'number' ? Number(unit) : unit;\n }),\n value: value\n });\n });\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var json = {};\n this.map(function (_ref3) {\n var key = _ref3.key,\n value = _ref3.value;\n json[key.join('.')] = value;\n return null;\n });\n return json;\n }\n }]);\n return NameMap;\n}();\nexport default NameMap;","map":{"version":3,"names":["_slicedToArray","_toConsumableArray","_classCallCheck","_createClass","_defineProperty","_typeof","SPLIT","normalize","namePath","map","cell","concat","join","NameMap","Map","key","value","set","kvs","get","update","updater","origin","next","delete","_delete","callback","entries","_ref","_ref2","cells","split","_cell$match","match","_cell$match2","type","unit","Number","toJSON","json","_ref3"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-field-form/es/utils/NameMap.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar SPLIT = '__@field_split__';\n\n/**\n * Convert name path into string to fast the fetch speed of Map.\n */\nfunction normalize(namePath) {\n return namePath.map(function (cell) {\n return \"\".concat(_typeof(cell), \":\").concat(cell);\n })\n // Magic split\n .join(SPLIT);\n}\n\n/**\n * NameMap like a `Map` but accepts `string[]` as key.\n */\nvar NameMap = /*#__PURE__*/function () {\n function NameMap() {\n _classCallCheck(this, NameMap);\n _defineProperty(this, \"kvs\", new Map());\n }\n _createClass(NameMap, [{\n key: \"set\",\n value: function set(key, value) {\n this.kvs.set(normalize(key), value);\n }\n }, {\n key: \"get\",\n value: function get(key) {\n return this.kvs.get(normalize(key));\n }\n }, {\n key: \"update\",\n value: function update(key, updater) {\n var origin = this.get(key);\n var next = updater(origin);\n if (!next) {\n this.delete(key);\n } else {\n this.set(key, next);\n }\n }\n }, {\n key: \"delete\",\n value: function _delete(key) {\n this.kvs.delete(normalize(key));\n }\n\n // Since we only use this in test, let simply realize this\n }, {\n key: \"map\",\n value: function map(callback) {\n return _toConsumableArray(this.kvs.entries()).map(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n var cells = key.split(SPLIT);\n return callback({\n key: cells.map(function (cell) {\n var _cell$match = cell.match(/^([^:]*):(.*)$/),\n _cell$match2 = _slicedToArray(_cell$match, 3),\n type = _cell$match2[1],\n unit = _cell$match2[2];\n return type === 'number' ? Number(unit) : unit;\n }),\n value: value\n });\n });\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var json = {};\n this.map(function (_ref3) {\n var key = _ref3.key,\n value = _ref3.value;\n json[key.join('.')] = value;\n return null;\n });\n return json;\n }\n }]);\n return NameMap;\n}();\nexport default NameMap;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,eAAe,MAAM,2CAA2C;AACvE,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,eAAe,MAAM,2CAA2C;AACvE,OAAOC,OAAO,MAAM,mCAAmC;AACvD,IAAIC,KAAK,GAAG,kBAAkB;;AAE9B;AACA;AACA;AACA,SAASC,SAASA,CAACC,QAAQ,EAAE;EAC3B,OAAOA,QAAQ,CAACC,GAAG,CAAC,UAAUC,IAAI,EAAE;IAClC,OAAO,EAAE,CAACC,MAAM,CAACN,OAAO,CAACK,IAAI,CAAC,EAAE,GAAG,CAAC,CAACC,MAAM,CAACD,IAAI,CAAC;EACnD,CAAC;EACD;EAAA,CACCE,IAAI,CAACN,KAAK,CAAC;AACd;;AAEA;AACA;AACA;AACA,IAAIO,OAAO,GAAG,aAAa,YAAY;EACrC,SAASA,OAAOA,CAAA,EAAG;IACjBX,eAAe,CAAC,IAAI,EAAEW,OAAO,CAAC;IAC9BT,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,IAAIU,GAAG,CAAC,CAAC,CAAC;EACzC;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