fix: math filters now return number, resolves #110

* fix linting
* numbers are no longer fixed:
    i.e. {{0.3 | minus 0.1}} now renders as 0.19999
    Stick to JavaScript number behavior, see: 8.0.0
This commit is contained in:
harttle
2019-02-28 13:02:51 +08:00
parent 21d674e22b
commit b4acdb463a
13 changed files with 1960 additions and 1981 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
const reported:{[key: string]: boolean} = {}
export function deprecate(msg: string, issue: number) {
export function deprecate (msg: string, issue: number) {
if (reported[msg]) return
console.warn(msg + ` See: https://github.com/harttle/liquidjs/issues/${issue}`)
reported[msg] = true
}
}
+1 -15
View File
@@ -96,21 +96,7 @@ export function isObject (value: any): value is object {
return value !== null && (type === 'object' || type === 'function')
}
/*
* A function to create flexibly-numbered lists of integers,
* handy for each and map loops. start, if omitted, defaults to 0; step defaults to 1.
* Returns a list of integers from start (inclusive) to stop (exclusive),
* incremented (or decremented) by step, exclusive.
* Note that ranges that stop before they start are considered to be zero-length instead of
* negative — if you'd like a negative range, use a negative step.
*/
export function range (start: number, stop?: number, step?: number) {
if (stop === undefined) {
stop = start
start = 0
}
step = step || 1
export function range (start: number, stop: number, step: number = 1) {
const arr: number[] = []
for (let i = start; i < stop; i += step) {
arr.push(i)