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 = O
|