a248aac528f89ea180057d0a4d5d273e.json 6.3 KB

1
  1. {"ast":null,"code":"const conversions = require('./conversions');\n\nconst route = require('./route');\n\nconst convert = {};\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n const wrappedFn = function (...args) {\n const arg0 = args[0];\n\n if (arg0 === undefined || arg0 === null) {\n return arg0;\n }\n\n if (arg0.length > 1) {\n args = arg0;\n }\n\n return fn(args);\n }; // Preserve .conversion property if there is one\n\n\n if ('conversion' in fn) {\n wrappedFn.conversion = fn.conversion;\n }\n\n return wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n const wrappedFn = function (...args) {\n const arg0 = args[0];\n\n if (arg0 === undefined || arg0 === null) {\n return arg0;\n }\n\n if (arg0.length > 1) {\n args = arg0;\n }\n\n const result = fn(args); // We're assuming the result is an array here.\n // see notice in conversions.js; don't use box types\n // in conversion functions.\n\n if (typeof result === 'object') {\n for (let len = result.length, i = 0; i < len; i++) {\n result[i] = Math.round(result[i]);\n }\n }\n\n return result;\n }; // Preserve .conversion property if there is one\n\n\n if ('conversion' in fn) {\n wrappedFn.conversion = fn.conversion;\n }\n\n return wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n convert[fromModel] = {};\n Object.defineProperty(convert[fromModel], 'channels', {\n value: conversions[fromModel].channels\n });\n Object.defineProperty(convert[fromModel], 'labels', {\n value: conversions[fromModel].labels\n });\n const routes = route(fromModel);\n const routeModels = Object.keys(routes);\n routeModels.forEach(toModel => {\n const fn = routes[toModel];\n convert[fromModel][toModel] = wrapRounded(fn);\n convert[fromModel][toModel].raw = wrapRaw(fn);\n });\n});\nmodule.exports = convert;","map":{"version":3,"sources":["/Users/jane/Documents/Курс Front-end/HW8/myproject/node_modules/pretty-format/node_modules/color-convert/index.js"],"names":["conversions","require","route","convert","models","Object","keys","wrapRaw","fn","wrappedFn","args","arg0","undefined","length","conversion","wrapRounded","result","len","i","Math","round","forEach","fromModel","defineProperty","value","channels","labels","routes","routeModels","toModel","raw","module","exports"],"m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CAfD;AAiBAuB,MAAM,CAACC,OAAP,GAAiB7B,OAAjB","sourcesContent":["const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n"]},"metadata":{},"sourceType":"script"}