This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isFlat = array => { | |
if (!array) return true; | |
for (let i = 0; i < array.length; i++) { | |
if (array[i] instanceof Array) return false; | |
} | |
return true; | |
} | |
const makeFlat = arr => { | |
while (!isFlat(arr)) arr = arr.reduce((a,b) => a.concat(b), []); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.filter('metric', function(authToken){ | |
return function(input, type, inch) { | |
var isMetric = authToken.getMetric(); | |
if(isMetric) { | |
if(type == 'cm') { | |
if(isNaN(input)) { | |
return 'cm.'; | |
} else { | |
if(inch) { | |
return ((((input * 12) * 1) + (inch * 1)) * 2.54).toFixed(2) + ' cm.'; |