aboutsummaryrefslogtreecommitdiff
path: root/src/declarations.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-08-13 15:34:18 +0530
committerAkshay Nair <phenax5@gmail.com>2023-08-13 15:34:18 +0530
commitc327a1dfc40b834b31c3488020859223f3583b4c (patch)
treee0090a6a49914f528bc4c1f517a329c3c0ae879a /src/declarations.ts
parent1f147a779114a641b4abe5e47ac0b05433ec02fb (diff)
downloadcss-everything-c327a1dfc40b834b31c3488020859223f3583b4c.tar.gz
css-everything-c327a1dfc40b834b31c3488020859223f3583b4c.zip
feat: adds add-children and remove-element actions
Diffstat (limited to 'src/declarations.ts')
-rw-r--r--src/declarations.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/declarations.ts b/src/declarations.ts
index 6c33fda..78c9801 100644
--- a/src/declarations.ts
+++ b/src/declarations.ts
@@ -87,11 +87,10 @@ export const toDeclaration = (expr: Expr): Declaration | undefined => {
return { selector, properties }
}
-export const extractDeclaration = async (
- input: string,
+export const expressionsToDeclrs = async (
+ exprs: Array<Expr>,
actions: EvalActions,
-): Promise<Array<DeclarationEval>> => {
- const exprs = parseDeclarations(input)
+) => {
const declrs = await Promise.all(
exprs
.map(toDeclaration)
@@ -100,3 +99,11 @@ export const extractDeclaration = async (
)
return declrs.filter(declr => !!declr) as Array<DeclarationEval>
}
+
+export const extractDeclaration = async (
+ input: string,
+ actions: EvalActions,
+): Promise<Array<DeclarationEval>> => {
+ const exprs = parseDeclarations(input)
+ return expressionsToDeclrs(exprs, actions)
+}