Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Add Transform for array #59

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions example/example4.jaksel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
whichis foo itu start from "jujurly","gue","rasa","ini","string",1,false,true
whichis bar itu start from 1,2,3,4,5
spill foo[0]
spill foo[1]
spill foo
11 changes: 10 additions & 1 deletion lib/utils/valueTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@ const booleanValue = (msg) => {
return null;
};

const arrayValue = (msg) => {
let arr = [];
if (msg.match(/start from/)) {
let modify = msg.split(' ').filter((word) => !['whichis', 'foo', 'itu', 'start', 'from'].includes(word));
arr = modify[0].split(",")
}
return `[${arr}]`;
}

const valueTransform = (msg) => {
let transforms = [booleanValue];
let transforms = [booleanValue, arrayValue];

for (const transform of transforms) {
let res = transform(msg);
Expand Down