Skip to content

Commit

Permalink
feat: move stringify function to block-store-actions-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Timmer committed Jul 12, 2024
1 parent ee04b43 commit 37584bc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
8 changes: 8 additions & 0 deletions __tests__/stringify/1.0/index.test.js
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] });
});
});
29 changes: 29 additions & 0 deletions functions/stringify/1.0/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"description": "Stringify a value",
"label": "Stringify",
"category": "Misc",
"icon": {
"name": "TextIcon",
"color": "Purple"
},
"options": [{
"meta": {
"type": "Value",
"allowedKinds": []
},
"name": "value",
"label": "Value",
"advanced": false
},
{
"meta": {
"type": "Output",
"output": {
"type": "Text"
}
},
"name": "result",
"label": "Result"
}],
"yields": "NONE"
}
7 changes: 7 additions & 0 deletions functions/stringify/1.0/index.js
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;

0 comments on commit 37584bc

Please sign in to comment.