Changeset 0c6b92a for imaps-frontend/node_modules/color-convert/index.js
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/color-convert/index.js
rd565449 r0c6b92a 1 varconversions = require('./conversions');2 varroute = require('./route');1 const conversions = require('./conversions'); 2 const route = require('./route'); 3 3 4 varconvert = {};4 const convert = {}; 5 5 6 varmodels = Object.keys(conversions);6 const models = Object.keys(conversions); 7 7 8 8 function wrapRaw(fn) { 9 var wrappedFn = function (args) { 10 if (args === undefined || args === null) { 11 return args; 9 const wrappedFn = function (...args) { 10 const arg0 = args[0]; 11 if (arg0 === undefined || arg0 === null) { 12 return arg0; 12 13 } 13 14 14 if (arg uments.length > 1) {15 args = Array.prototype.slice.call(arguments);15 if (arg0.length > 1) { 16 args = arg0; 16 17 } 17 18 … … 19 20 }; 20 21 21 // preserve .conversion property if there is one22 // Preserve .conversion property if there is one 22 23 if ('conversion' in fn) { 23 24 wrappedFn.conversion = fn.conversion; … … 28 29 29 30 function wrapRounded(fn) { 30 var wrappedFn = function (args) { 31 if (args === undefined || args === null) { 32 return args; 31 const wrappedFn = function (...args) { 32 const arg0 = args[0]; 33 34 if (arg0 === undefined || arg0 === null) { 35 return arg0; 33 36 } 34 37 35 if (arg uments.length > 1) {36 args = Array.prototype.slice.call(arguments);38 if (arg0.length > 1) { 39 args = arg0; 37 40 } 38 41 39 varresult = fn(args);42 const result = fn(args); 40 43 41 // we're assuming the result is an array here.44 // We're assuming the result is an array here. 42 45 // see notice in conversions.js; don't use box types 43 46 // in conversion functions. 44 47 if (typeof result === 'object') { 45 for ( varlen = result.length, i = 0; i < len; i++) {48 for (let len = result.length, i = 0; i < len; i++) { 46 49 result[i] = Math.round(result[i]); 47 50 } … … 51 54 }; 52 55 53 // preserve .conversion property if there is one56 // Preserve .conversion property if there is one 54 57 if ('conversion' in fn) { 55 58 wrappedFn.conversion = fn.conversion; … … 59 62 } 60 63 61 models.forEach(f unction (fromModel){64 models.forEach(fromModel => { 62 65 convert[fromModel] = {}; 63 66 … … 65 68 Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); 66 69 67 varroutes = route(fromModel);68 varrouteModels = Object.keys(routes);70 const routes = route(fromModel); 71 const routeModels = Object.keys(routes); 69 72 70 routeModels.forEach( function (toModel){71 varfn = routes[toModel];73 routeModels.forEach(toModel => { 74 const fn = routes[toModel]; 72 75 73 76 convert[fromModel][toModel] = wrapRounded(fn);
Note:
See TracChangeset
for help on using the changeset viewer.