mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
refactor: use camelCase for JavaScript APIs
BREAKING CHANGE: Options and method names in JavaScript API are now renamed to cammelCase, for a complete list see #109
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
const reported:{[key: string]: boolean} = {}
|
||||
|
||||
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,4 +1,3 @@
|
||||
import { deprecate } from './deprecate'
|
||||
const toStr = Object.prototype.toString
|
||||
|
||||
/*
|
||||
@@ -29,18 +28,10 @@ export function promisify (fn: any) {
|
||||
export function stringify (value: any): string {
|
||||
if (isNil(value)) return ''
|
||||
value = toLiquid(value)
|
||||
if (isFunction(value.to_s)) {
|
||||
deprecate('to_s is deprecated, use toString instead.', 109)
|
||||
return value.to_s()
|
||||
}
|
||||
return String(value)
|
||||
}
|
||||
|
||||
export function toLiquid (value: any): any {
|
||||
if (isFunction(value.to_liquid)) {
|
||||
deprecate('to_liquid is deprecated, use toLiquid instead.', 109)
|
||||
return toLiquid(value.to_liquid())
|
||||
}
|
||||
if (isFunction(value.toLiquid)) return toLiquid(value.toLiquid())
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user