-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from bettyblocks/feat/move-json-stringify-fun…
…ction-DT-4043 feat: move stringify function to block-store-actions-functions
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import stringify from '../../../functions/stringify/1.0'; | ||
|
||
describe('stringify', () => { | ||
test('It returns the given string value', async () => { | ||
const { result } = await stringify({ value: { test: [1, 2, 3] } }); | ||
expect(JSON.parse(result)).toEqual({ test: [1, 2, 3] }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dependencies": [], | ||
"functions": ["stringify 1.0"], | ||
"includes": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"description": "Stringify any value to json via JSON.stringify", | ||
"label": "Stringify", | ||
"category": "Misc", | ||
"icon": { | ||
"name": "TextIcon", | ||
"color": "Purple" | ||
}, | ||
"options": [ | ||
{ | ||
"meta": { | ||
"type": "Value", | ||
"allowedKinds": [], | ||
"validations": { | ||
"required": true | ||
} | ||
}, | ||
"name": "value", | ||
"label": "Value", | ||
"advanced": false | ||
}, | ||
{ | ||
"meta": { | ||
"type": "Output", | ||
"output": { | ||
"type": "Text" | ||
}, | ||
"validations": { | ||
"required": true | ||
} | ||
}, | ||
"name": "result", | ||
"label": "Result" | ||
} | ||
], | ||
"yields": "NONE" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const stringify = async ({ value }) => { | ||
return { | ||
result: JSON.stringify(value), | ||
}; | ||
}; | ||
|
||
export default stringify; |