We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19fd3c6 commit 689d861Copy full SHA for 689d861
src/nodes/Array.Reverse.ts
@@ -0,0 +1,36 @@
1
+import { ModuleCompute, ModuleDefinition } from '@nodescript/core/types';
2
+
3
+type P = {
4
+ array: unknown[];
5
+};
6
7
+type R = unknown[];
8
9
+export const module: ModuleDefinition<P, R> = {
10
+ version: '1.0.0',
11
+ moduleName: 'Array / Reverse',
12
+ description: `
13
+ Returns a new array with elements in reversed order.
14
+ `,
15
+ keywords: ['invert', 'flip'],
16
+ params: {
17
+ array: {
18
+ schema: {
19
+ type: 'array',
20
+ items: { type: 'any' },
21
+ },
22
+ hideEntries: true,
23
24
25
+ result: {
26
27
28
29
+ }
30
31
32
33
+export const compute: ModuleCompute<P, R> = params => {
34
+ const { array } = params;
35
+ return [...array].reverse();
36
0 commit comments