mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
perf: use polymophism instead duck test
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { AssertionError } from './error'
|
||||
|
||||
export default function (predicate: any, message?: string) {
|
||||
export default function<T> (predicate: T | null | undefined, message?: string) {
|
||||
if (!predicate) {
|
||||
message = message || `expect ${predicate} to be true`
|
||||
throw new AssertionError(message)
|
||||
|
||||
@@ -36,10 +36,6 @@ export function toLiquid (value: any): any {
|
||||
return value
|
||||
}
|
||||
|
||||
export function create<T1 extends object, T2 extends T1 = T1> (proto: T1): T2 {
|
||||
return Object.create(proto)
|
||||
}
|
||||
|
||||
export function isNil (value: any): boolean {
|
||||
return value === null || value === undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user