-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathto_array.yml
More file actions
65 lines (65 loc) · 1.18 KB
/
to_array.yml
File metadata and controls
65 lines (65 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: to_array
topic: conversion
args:
required:
- name: arg
type: any
returns:
type: array
desc: |
* array - Returns the passed in value.
* number/string/object/boolean/null - Returns a one element array containing
the passed in argument.
examples:
test0:
context:
args: [[1, 2]]
returns: [1, 2]
test1:
context:
args: ["'string'"]
returns: [string]
test2:
context:
args: [0]
returns: [0]
test3:
context:
args: [true]
returns: [true]
test4:
context:
args: [foo: "'bar'"]
returns: [foo: bar]
test5:
context: &data
foo: -1
zero: 0
numbers: [-1, 3, 4, 5]
array: [-1, 3, 4, 5, a, '100']
strings: [a, b, c]
decimals: [1.01, 1.2, -1.5]
str: Str
'false': false
empty_list: []
empty_hash: {}
objects: {foo: bar, bar: baz}
null_key:
args: ["'foo'"]
returns: [foo]
test6:
context: *data
args: [0]
returns: [0]
test7:
context: *data
args: [objects]
returns: [{foo: bar, bar: baz}]
test8:
context: *data
args: [[1, 2, 3]]
returns: [1, 2, 3]
test9:
context: *data
args: [false]
returns: [false]