mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
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:
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user