1 line
6.4 KiB
JSON
1 line
6.4 KiB
JSON
{"ast":null,"code":"var conversions = require('./conversions');\n\nvar route = require('./route');\n\nvar convert = {};\nvar models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n var wrappedFn = function wrappedFn(args) {\n if (args === undefined || args === null) {\n return args;\n }\n\n if (arguments.length > 1) {\n args = Array.prototype.slice.call(arguments);\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 var wrappedFn = function wrappedFn(args) {\n if (args === undefined || args === null) {\n return args;\n }\n\n if (arguments.length > 1) {\n args = Array.prototype.slice.call(arguments);\n }\n\n var 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 (var 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(function (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 var routes = route(fromModel);\n var routeModels = Object.keys(routes);\n routeModels.forEach(function (toModel) {\n var fn = routes[toModel];\n convert[fromModel][toModel] = wrapRounded(fn);\n convert[fromModel][toModel].raw = wrapRaw(fn);\n });\n});\nmodule.exports = convert;","map":{"version":3,"names":["conversions","require","route","convert","models","Object","keys","wrapRaw","fn","wrappedFn","args","undefined","arguments","length","Array","prototype","slice","call","conversion","wrapRounded","result","len","i","Math","round","forEach","fromModel","defineProperty","value","channels","labels","routes","routeModels","toModel","raw","module","exports"],"sources":["/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/color-convert/index.js"],"sourcesContent":["var conversions = require('./conversions');\nvar route = require('./route');\n\nvar convert = {};\n\nvar models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tvar wrappedFn = function (args) {\n\t\tif (args === undefined || args === null) {\n\t\t\treturn args;\n\t\t}\n\n\t\tif (arguments.length > 1) {\n\t\t\targs = Array.prototype.slice.call(arguments);\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\tvar wrappedFn = function (args) {\n\t\tif (args === undefined || args === null) {\n\t\t\treturn args;\n\t\t}\n\n\t\tif (arguments.length > 1) {\n\t\t\targs = Array.prototype.slice.call(arguments);\n\t\t}\n\n\t\tvar 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 (var 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(function (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\tvar routes = route(fromModel);\n\tvar routeModels = Object.keys(routes);\n\n\trouteModels.forEach(function (toModel) {\n\t\tvar 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"],"mappings":"AAAA,IAAIA,WAAW,GAAGC,OAAO,CAAC,eAAD,CAAzB;;A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