1 line
9.6 KiB
JSON
1 line
9.6 KiB
JSON
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _toArray from \"@babel/runtime/helpers/esm/toArray\";\nimport get from \"./get\";\nfunction internalSet(entity, paths, value, removeIfUndefined) {\n if (!paths.length) {\n return value;\n }\n var _paths = _toArray(paths),\n path = _paths[0],\n restPath = _paths.slice(1);\n var clone;\n if (!entity && typeof path === 'number') {\n clone = [];\n } else if (Array.isArray(entity)) {\n clone = _toConsumableArray(entity);\n } else {\n clone = _objectSpread({}, entity);\n }\n\n // Delete prop if `removeIfUndefined` and value is undefined\n if (removeIfUndefined && value === undefined && restPath.length === 1) {\n delete clone[path][restPath[0]];\n } else {\n clone[path] = internalSet(clone[path], restPath, value, removeIfUndefined);\n }\n return clone;\n}\nexport default function set(entity, paths, value) {\n var removeIfUndefined = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n // Do nothing if `removeIfUndefined` and parent object not exist\n if (paths.length && removeIfUndefined && value === undefined && !get(entity, paths.slice(0, -1))) {\n return entity;\n }\n return internalSet(entity, paths, value, removeIfUndefined);\n}\nfunction isObject(obj) {\n return _typeof(obj) === 'object' && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;\n}\nfunction createEmpty(source) {\n return Array.isArray(source) ? [] : {};\n}\nvar keys = typeof Reflect === 'undefined' ? Object.keys : Reflect.ownKeys;\n\n/**\n * Merge objects which will create\n */\nexport function merge() {\n for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n var clone = createEmpty(sources[0]);\n sources.forEach(function (src) {\n function internalMerge(path, parentLoopSet) {\n var loopSet = new Set(parentLoopSet);\n var value = get(src, path);\n var isArr = Array.isArray(value);\n if (isArr || isObject(value)) {\n // Only add not loop obj\n if (!loopSet.has(value)) {\n loopSet.add(value);\n var originValue = get(clone, path);\n if (isArr) {\n // Array will always be override\n clone = set(clone, path, []);\n } else if (!originValue || _typeof(originValue) !== 'object') {\n // Init container if not exist\n clone = set(clone, path, createEmpty(value));\n }\n keys(value).forEach(function (key) {\n internalMerge([].concat(_toConsumableArray(path), [key]), loopSet);\n });\n }\n } else {\n clone = set(clone, path, value);\n }\n }\n internalMerge([]);\n });\n return clone;\n}","map":{"version":3,"names":["_typeof","_objectSpread","_toConsumableArray","_toArray","get","internalSet","entity","paths","value","removeIfUndefined","length","_paths","path","restPath","slice","clone","Array","isArray","undefined","set","arguments","isObject","obj","Object","getPrototypeOf","prototype","createEmpty","source","keys","Reflect","ownKeys","merge","_len","sources","_key","forEach","src","internalMerge","parentLoopSet","loopSet","Set","isArr","has","add","originValue","key","concat"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-util/es/utils/set.js"],"sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _toArray from \"@babel/runtime/helpers/esm/toArray\";\nimport get from \"./get\";\nfunction internalSet(entity, paths, value, removeIfUndefined) {\n if (!paths.length) {\n return value;\n }\n var _paths = _toArray(paths),\n path = _paths[0],\n restPath = _paths.slice(1);\n var clone;\n if (!entity && typeof path === 'number') {\n clone = [];\n } else if (Array.isArray(entity)) {\n clone = _toConsumableArray(entity);\n } else {\n clone = _objectSpread({}, entity);\n }\n\n // Delete prop if `removeIfUndefined` and value is undefined\n if (removeIfUndefined && value === undefined && restPath.length === 1) {\n delete clone[path][restPath[0]];\n } else {\n clone[path] = internalSet(clone[path], restPath, value, removeIfUndefined);\n }\n return clone;\n}\nexport default function set(entity, paths, value) {\n var removeIfUndefined = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n // Do nothing if `removeIfUndefined` and parent object not exist\n if (paths.length && removeIfUndefined && value === undefined && !get(entity, paths.slice(0, -1))) {\n return entity;\n }\n return internalSet(entity, paths, value, removeIfUndefined);\n}\nfunction isObject(obj) {\n return _typeof(obj) === 'object' && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;\n}\nfunction createEmpty(source) {\n return Array.isArray(source) ? [] : {};\n}\nvar keys = typeof Reflect === 'undefined' ? Object.keys : Reflect.ownKeys;\n\n/**\n * Merge objects which will create\n */\nexport function merge() {\n for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n var clone = createEmpty(sources[0]);\n sources.forEach(function (src) {\n function internalMerge(path, parentLoopSet) {\n var loopSet = new Set(parentLoopSet);\n var value = get(src, path);\n var isArr = Array.isArray(value);\n if (isArr || isObject(value)) {\n // Only add not loop obj\n if (!loopSet.has(value)) {\n loopSet.add(value);\n var originValue = get(clone, path);\n if (isArr) {\n // Array will always be override\n clone = set(clone, path, []);\n } else if (!originValue || _typeof(originValue) !== 'object') {\n // Init container if not exist\n clone = set(clone, path, createEmpty(value));\n }\n keys(value).forEach(function (key) {\n internalMerge([].concat(_toConsumableArray(path), [key]), loopSet);\n });\n }\n } else {\n clone = set(clone, path, value);\n }\n }\n internalMerge([]);\n });\n return clone;\n}"],"mappings":"AAAA,OAAOA,OAAO,MAAM,mCAAmC;AACvD,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,GAAG,MAAM,OAAO;AACvB,SAASC,WAAWA,CAACC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,iBAAiB,EAAE;EAC5D,IAAI,CAACF,KAAK,CAACG,MAAM,EAAE;IACjB,OAAOF,KAAK;EACd;EACA,IAAIG,MAAM,GAAGR,QAAQ,CAACI,KAAK,CAAC;IAC1BK,IAAI,GAAGD,MAAM,CAAC,CAAC,CAAC;IAChBE,QAAQ,GAAGF,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