Created
June 1, 2018 18:26
-
-
Save Hokid/9d7680bb78c7144ff70d86bc960be27e to your computer and use it in GitHub Desktop.
This file contains 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
export function throwIfNotInstanse(instance, constructor) { | |
if (!(instance instanceof constructor)) { | |
throw new TypeError('object not instance of ' + constructor.name); | |
} | |
} | |
export function byId(list, id) { | |
return list.find((i) => i.id === id); | |
} | |
export function stripUnnecessaryZeros(number) { | |
return number.replace(/(\.0+|0+)$/, ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment