Skip to content

Commit

Permalink
docs: add more jp functions examples (#2055)
Browse files Browse the repository at this point in the history
* docs: add more jp functions examples

Signed-off-by: Charles-Edouard Brétéché <[email protected]>

* docs: add more jp functions examples

Signed-off-by: Charles-Edouard Brétéché <[email protected]>

---------

Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly authored Oct 1, 2024
1 parent 0f01d17 commit 7c5e0c6
Show file tree
Hide file tree
Showing 56 changed files with 328 additions and 64 deletions.
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/at.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Returns the element in an array at the given index.

## Examples

TODO
```
at([`10`,`15`,`20`], `1`) == `15`
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/concat.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Concatenates two strings together and returns the result.

## Examples

TODO
```
concat('foo', 'bar') == 'foobar'
```
8 changes: 4 additions & 4 deletions website/docs/reference/jp/examples/contains.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ Returns `true` if the given subject contains the provided search value. If the s
### With strings

```
contains('foobar', 'bar') == true
contains('foobar', 'bar') == `true`
```

```
contains('foobar', 'not') == false
contains('foobar', 'not') == `false`
```

### With arrays


```
contains(['foo', 'bar'], 'bar') == true
contains(['foo', 'bar'], 'bar') == `true`
```

```
contains(['foo', 'bar'], 'not') == true
contains(['foo', 'bar'], 'not') == `true`
```
4 changes: 2 additions & 2 deletions website/docs/reference/jp/examples/ends_with.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Reports whether the given string ends with the provided suffix argument.
## Examples

```
ends_with('foobar', 'bar') == true
ends_with('foobar', 'bar') == `true`
```

```
ends_with('foobar', 'foo') == false
ends_with('foobar', 'foo') == `false`
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/json_parse.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Parses a given JSON string into an object.

## Examples

TODO
```
json_parse('{"foo":"bar"}') == { foo: 'bar' }
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Returns an array containing the keys of the provided object.

## Examples

TODO
```
keys({bar:'bam',foo:'baz'}) == ['bar','foo']
```
12 changes: 11 additions & 1 deletion website/docs/reference/jp/examples/length.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ Returns the length of the given argument. If the argument is a string this funct

## Examples

TODO
```
length([`10`,`15`,`20`]) == `3`
```

```
length([]) == `0`
```

```
length(null) -> error
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/lower.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Returns the given string with all Unicode letters mapped to their lower case.

## Examples

TODO
```
lower('FOOBAR') == 'foobar'
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/not_null.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Returns the first non null element in the input array.

## Examples

TODO
```
not_null(null, null, 'foo') == 'foo'
```

```
not_null(null, null) == null
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Replaces a specified number of instances of the source string with the replaceme

## Examples

TODO
```
replace('foobar', 'oo', 'ii') == 'fiibar'
```

```
replace('foobar', 'o', 'i', `1`) == 'fiobar'
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Reverses the input string or array and returns the result.

## Examples

TODO
```
reverse('abcd') == 'dcba'
```

```
reverse([`1`, `2`, `3`, `4`]) == [`4`, `3`, `2`, `1`]
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ This function accepts an array argument and returns the sorted elements as an ar

## Examples

TODO
```
sort(['b', 'a', 'c']) == ['a', 'b', 'c']
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/split.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Splits the first string when the second string is found and converts it into an

## Examples

TODO
```
split('average|-|min|-|max|-|mean|-|median', '|-|', `3`) == ['average', 'min', 'max', 'mean|-|median']
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/starts_with.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Reports whether the input string begins with the provided string prefix argument

## Examples

TODO
```
starts_with('foobar', 'foo') == `true`
```

```
starts_with('foobar', 'bar') == `false`
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/sum.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Does arithmetic addition of specified array of values of numbers, quantities, an

## Examples

TODO
```
sum(`[]`) == `0`
```

```
sum([`10`, `15`]) == `25`
```
12 changes: 11 additions & 1 deletion website/docs/reference/jp/examples/to_array.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ Returns a one element array containing the passed in argument, or the passed in

## Examples

TODO
```
to_array(`true`) == [`true`]
```

```
to_array([`10`, `15`, `20`]) == [`10`, `15`, `20`]
```

```
to_array(`[]`) == []
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/to_lower.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Takes in a string and outputs the same string with all lower-case letters.

## Examples

TODO
```
lower('FOOBAR') == 'foobar'
```
12 changes: 11 additions & 1 deletion website/docs/reference/jp/examples/to_number.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ Returns the parsed number.

## Examples

TODO
```
to_number('1.0') == `1`
```

```
to_number(`1.0`) == `1`
```

```
to_number(`false`) == null
```
16 changes: 15 additions & 1 deletion website/docs/reference/jp/examples/to_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,18 @@ The JSON encoded value of the given argument.

## Examples

TODO
```
to_string(`2`) == '2'
```

```
to_string('foobar') == 'foobar'
```

```
to_string(null) == 'null'
```

```
to_string({bar:'bam',foo:'baz'}) == '{"bar":"bam","foo":"baz"}'
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/to_upper.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Takes in a string and outputs the same string with all upper-case letters.

## Examples

TODO
```
upper('foobar') == 'FOOBAR'
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/trim.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Trims both ends of the source string by characters appearing in the second strin

## Examples

TODO
```
trim(' foobar ', 'fbr ') == 'ooba'
```

```
trim(' foobar ', 'fbr') == ' foobar '
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/trim_left.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Removes the leading characters found in the passed in string argument.

## Examples

TODO
```
trim_left(' foobar ', 'fbr ') == 'oobar '
```

```
trim_left(' foobar ', 'fbr') == ' foobar '
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/trim_right.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Removes the trailing characters found in the passed in string argument.

## Examples

TODO
```
trim_right(' foobar ', 'fbr ') == ' fooba'
```

```
trim_right(' foobar ', 'fbr') == ' foobar '
```
12 changes: 11 additions & 1 deletion website/docs/reference/jp/examples/type.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,14 @@ Returns the JavaScript type of the given argument as a string value.

## Examples

TODO
```
type(`false`) == 'boolean'
```

```
type(null) == 'null'
```

```
type('foobar') == 'string'
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/upper.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Returns the given string with all Unicode letters mapped to their upper case.

## Examples

TODO
```
upper('foobar') == 'FOOBAR'
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/values.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Returns the values of the provided object.

## Examples

TODO
```
values({bar:'bam',foo:'baz'}) == ['bam','baz']
```
8 changes: 7 additions & 1 deletion website/docs/reference/jp/examples/wildcard.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ Compares a wildcard pattern with a given string and returns if they match or not

## Examples

TODO
```
wildcard('foo*', 'foobar') == `true`
```

```
wildcard('fooba?', 'foobar') == `true`
```
4 changes: 3 additions & 1 deletion website/docs/reference/jp/examples/zip.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Accepts one or more arrays as arguments and returns an array of arrays in which

## Examples

TODO
```
zip(['a', 'b'], [`1`, `2`]) == [['a', `1`], ['b', `2`]]
```
4 changes: 3 additions & 1 deletion website/jp/examples/at.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
TODO
```
at([`10`,`15`,`20`], `1`) == `15`
```
4 changes: 3 additions & 1 deletion website/jp/examples/concat.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
TODO
```
concat('foo', 'bar') == 'foobar'
```
8 changes: 4 additions & 4 deletions website/jp/examples/contains.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
### With strings

```
contains('foobar', 'bar') == true
contains('foobar', 'bar') == `true`
```

```
contains('foobar', 'not') == false
contains('foobar', 'not') == `false`
```

### With arrays


```
contains(['foo', 'bar'], 'bar') == true
contains(['foo', 'bar'], 'bar') == `true`
```

```
contains(['foo', 'bar'], 'not') == true
contains(['foo', 'bar'], 'not') == `true`
```
4 changes: 2 additions & 2 deletions website/jp/examples/ends_with.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```
ends_with('foobar', 'bar') == true
ends_with('foobar', 'bar') == `true`
```

```
ends_with('foobar', 'foo') == false
ends_with('foobar', 'foo') == `false`
```
4 changes: 3 additions & 1 deletion website/jp/examples/json_parse.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
TODO
```
json_parse('{"foo":"bar"}') == { foo: 'bar' }
```
4 changes: 3 additions & 1 deletion website/jp/examples/keys.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
TODO
```
keys({bar:'bam',foo:'baz'}) == ['bar','foo']
```
12 changes: 11 additions & 1 deletion website/jp/examples/length.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
TODO
```
length([`10`,`15`,`20`]) == `3`
```

```
length([]) == `0`
```

```
length(null) -> error
```
4 changes: 3 additions & 1 deletion website/jp/examples/lower.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
TODO
```
lower('FOOBAR') == 'foobar'
```
Loading

0 comments on commit 7c5e0c6

Please sign in to comment.