summaryrefslogtreecommitdiff
path: root/src/eval.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-08-25 18:58:47 +0530
committerAkshay Nair <phenax5@gmail.com>2023-08-25 19:00:57 +0530
commit8058d047a5a50406ff4175c83b8488eea7c4e706 (patch)
tree7256dcde0c396fafad9ff2ca45b9eaa33691db3b /src/eval.ts
parentca0737e393bbf5c45f688593bbfaf41079a66784 (diff)
downloadcss-everything-8058d047a5a50406ff4175c83b8488eea7c4e706.tar.gz
css-everything-8058d047a5a50406ff4175c83b8488eea7c4e706.zip
docs: crazy amounts of docs
Diffstat (limited to '')
-rw-r--r--src/eval.ts14
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 () => {