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:
Jun Yang
2019-03-10 19:21:09 +08:00
parent 4a8088d4e4
commit 64e0c876e9
12 changed files with 16 additions and 68 deletions
-7
View File
@@ -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
}
-9
View File
@@ -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
}