diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-08-25 18:58:47 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-08-25 19:00:57 +0530 |
| commit | 8058d047a5a50406ff4175c83b8488eea7c4e706 (patch) | |
| tree | 7256dcde0c396fafad9ff2ca45b9eaa33691db3b /src/eval.ts | |
| parent | ca0737e393bbf5c45f688593bbfaf41079a66784 (diff) | |
| download | css-everything-8058d047a5a50406ff4175c83b8488eea7c4e706.tar.gz css-everything-8058d047a5a50406ff4175c83b8488eea7c4e706.zip | |
docs: crazy amounts of docs
Diffstat (limited to 'src/eval.ts')
| -rw-r--r-- | src/eval.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/eval.ts b/src/eval.ts index 9a55828..636023b 100644 --- a/src/eval.ts +++ b/src/eval.ts @@ -82,11 +82,11 @@ export const evalExpr = async ( } const QUOTE_REGEX = /^['"](.*)(?=['"]$)['"]$/g -const dequotify = (s: string) => s.replace(QUOTE_REGEX, '$1') +const unquotify = (s: string) => s.replace(QUOTE_REGEX, '$1') export const evalValueToString = (val: EvalValue): string | undefined => match<string | undefined, EvalValue>(val, { - String: s => dequotify(s), + String: s => unquotify(s), Boolean: b => `${b}`, Number: n => `${n}`, VarIdentifier: s => s, @@ -105,7 +105,7 @@ const evalValueToNumber = (val: EvalValue): number | undefined => const evalValueToBoolean = (val: EvalValue): boolean => match<boolean, EvalValue>(val, { - String: s => !['false', '', '0'].includes(dequotify(s)), + String: s => !['false', '', '0'].includes(unquotify(s)), Boolean: b => b, Number: n => !!n, Value: v => !!v, @@ -282,6 +282,10 @@ const getFunctions = ( seq: async () => EvalValue.Lazy(args), + // noop + noop: async () => EvalValue.Void(), + func: async () => EvalValue.Void(), + call: async () => { const varId = match<string | undefined, EvalValue>( await evalExpr(args[0], actions), @@ -321,9 +325,9 @@ const getFunctions = ( const str = await evalExprAsString(args[0], actions) return EvalValue.String(`'${str || ''}'`) }, - dequotify: async () => { + unquotify: async () => { const str = await evalExprAsString(args[0], actions) - return EvalValue.String(dequotify(str || '')) + return EvalValue.String(unquotify(str || '')) }, try: async () => { |
