diff --git a/source/ow.ts b/source/ow.ts index e50827d..ae44740 100644 --- a/source/ow.ts +++ b/source/ow.ts @@ -10,16 +10,19 @@ export interface Ow { string: StringPredicate; } -export const ow: Ow = Object.assign( - (value: any, predicate: Predicate) => { - for (const { validator, message } of predicate[validatorSymbol]) { - if (!validator(value)) { - // TODO: Modify the stack output to show the original `ow()` call instead of this `throw` statement - throw new ArgumentError(message(value), ow); - } +const main = (value: any, predicate: Predicate) => { + for (const { validator, message } of predicate[validatorSymbol]) { + if (!validator(value)) { + // TODO: Modify the stack output to show the original `ow()` call instead of this `throw` statement + throw new ArgumentError(message(value), main); } - }, - { - string: new StringPredicate() } -); +}; + +Object.defineProperties(main, { + string: { + get: () => new StringPredicate() + } +}); + +export const ow = main as Ow;