-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: andrew-coleman <[email protected]>
- Loading branch information
1 parent
6198e10
commit 0428342
Showing
33 changed files
with
3,144 additions
and
1 deletion.
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
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
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,85 @@ | ||
/** | ||
* Copyright (c) 2017-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const React = require('react'); | ||
|
||
const CompLibrary = require('../../core/CompLibrary'); | ||
|
||
const Container = CompLibrary.Container; | ||
|
||
const CWD = process.cwd(); | ||
|
||
const versions = require(`${CWD}/versions.json`); | ||
|
||
function Versions(props) { | ||
const {config: siteConfig} = props; | ||
const latestVersion = versions[0]; | ||
const releases = 'https://github.com/jsonata-js/jsonata/releases'; | ||
return ( | ||
<div className="docMainWrapper wrapper"> | ||
<Container className="mainContainer versionsContainer"> | ||
<div className="post"> | ||
<header className="postHeader"> | ||
<h1>{siteConfig.title} Versions</h1> | ||
</header> | ||
<p>New versions of this project are released every so often.</p> | ||
<h3 id="latest">Current version (Stable)</h3> | ||
<table className="versions"> | ||
<tbody> | ||
<tr> | ||
<th>{latestVersion}</th> | ||
<td> | ||
<a href="overview">Documentation</a> | ||
</td> | ||
<td> | ||
<a href={releases + '/latest'}>Release Notes</a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p> | ||
This is the current version of JSONata when installed from NPM | ||
</p> | ||
<h3 id="rc">Pre-release versions</h3> | ||
<table className="versions"> | ||
<tbody> | ||
<tr> | ||
<th>master</th> | ||
<td> | ||
<a href="next/overview">Documentation</a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p>This is the latest development version of JSONata as committed to 'master' branch. This version may be unstable.</p> | ||
<h3 id="archive">Past Versions</h3> | ||
<table className="versions"> | ||
<tbody> | ||
{versions.map( | ||
version => | ||
version !== latestVersion && ( | ||
<tr> | ||
<th>{version}</th> | ||
<td> | ||
<a href={version + '/overview'}>Documentation</a> | ||
</td> | ||
<td> | ||
<a href={releases + '/tag/v' + version}>Release Notes</a> | ||
</td> | ||
</tr> | ||
), | ||
)} | ||
</tbody> | ||
</table> | ||
</div> | ||
</Container> | ||
</div> | ||
); | ||
} | ||
|
||
module.exports = Versions; | ||
|
44 changes: 44 additions & 0 deletions
44
website/versioned_docs/version-1.7.0/aggregation-functions.md
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,44 @@ | ||
--- | ||
id: version-1.7.0-aggregation-functions | ||
title: Numeric aggregation functions | ||
sidebar_label: Aggregation Functions | ||
original_id: aggregation-functions | ||
--- | ||
|
||
## `$sum()` | ||
__Signature:__ `$sum(array)` | ||
|
||
Returns the arithmetic sum of an array of numbers. It is an error if the input array contains an item which isn't a number. | ||
|
||
__Example__ | ||
|
||
- `$sum([5,1,3,7,4])` => `20` | ||
|
||
## `$max()` | ||
__Signature:__ `$max(array)` | ||
|
||
Returns the maximum number in an array of numbers. It is an error if the input array contains an item which isn't a number. | ||
|
||
__Example__ | ||
|
||
- `$max([5,1,3,7,4])` => `7` | ||
|
||
## `$min()` | ||
__Signature:__ `$min(array)` | ||
|
||
Returns the minimum number in an array of numbers. It is an error if the input array contains an item which isn't a number. | ||
|
||
__Example__ | ||
|
||
- `$min([5,1,3,7,4])` => `1` | ||
|
||
## `$average()` | ||
__Signature:__ `$average(array)` | ||
|
||
Returns the mean value of an array of numbers. It is an error if the input array contains an item which isn't a number. | ||
|
||
__Example__ | ||
|
||
- `$average([5,1,3,7,4])` => `4` | ||
|
||
|
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,86 @@ | ||
--- | ||
id: version-1.7.0-array-functions | ||
title: Array Functions | ||
original_id: array-functions | ||
--- | ||
|
||
## `$count()` | ||
__Signature:__ `$count(array)` | ||
|
||
Returns the number of items in the `array` parameter. If the `array` parameter is not an array, but rather a value of another JSON type, then the parameter is treated as a singleton array containing that value, and this function returns `1`. | ||
|
||
If `array` is not specified, then the context value is used as the value of `array`. | ||
|
||
__Examples__ | ||
- `$count([1,2,3,1])` => `4` | ||
- `$count("hello")` => 1 | ||
|
||
## `$append()` | ||
__Signature:__ `$append(array1, array2)` | ||
|
||
Returns and array containing the values in `array1` followed by the values in `array2`. If either parameter is not an array, then it is treated as a singleton array containing that value. | ||
|
||
__Examples__ | ||
- `$append([1,2,3], [4,5,6])` => `[1,2,3,4,5,6]` | ||
- `$append([1,2,3], 4)` => `[1,2,3,4]` | ||
- `$append("Hello", "World")` => `["Hello", "World"]` | ||
|
||
|
||
## `$sort()` | ||
__Signature:__ `$sort(array [, function])` | ||
|
||
Returns an array containing all the values in the `array` parameter, but sorted into order. If no `function` parameter is supplied, then the `array` parameter must contain only numbers or only strings, and they will be sorted in order of increasing number, or increasing unicode codepoint respectively. | ||
|
||
If a comparator `function` is supplied, then is must be a function that takes two parameters: | ||
|
||
`function(left, right)` | ||
|
||
This function gets invoked by the sorting algorithm to compare two values `left` and `right`. If the value of `left` should be placed after the value of `right` in the desired sort order, then the function must return Boolean `true` to indicate a swap. Otherwise it must return `false`. | ||
|
||
__Example__ | ||
``` | ||
$sort(Account.Order.Product, function($l, $r) { | ||
$l.Description.Weight > $r.Description.Weight | ||
}) | ||
``` | ||
|
||
This sorts the products in order of increasing weight. | ||
|
||
The sorting algorithm is *stable* which means that values within the original array which are the same according to the comparator function will remain in the original order in the sorted array. | ||
|
||
## `$reverse()` | ||
__Signature:__ `$reverse(array)` | ||
|
||
Returns an array containing all the values from the `array` parameter, but in reverse order. | ||
|
||
__Examples__ | ||
- `$reverse(["Hello", "World"])` => `["World", "Hello"]` | ||
- `[1..5] ~> $reverse()` => `[5, 4, 3, 2, 1]` | ||
|
||
## `$shuffle()` | ||
__Signature:__ `$shuffle(array)` | ||
|
||
Returns an array containing all the values from the `array` parameter, but shuffled into random order. | ||
|
||
__Examples__ | ||
- `$shuffle([1..9])` => `[6, 8, 2, 3, 9, 5, 1, 4, 7]` | ||
|
||
## `$distinct()` | ||
__Signature__ `$distinct(array)` | ||
|
||
Returns an array containing all the values from the `array` parameter, but with any duplicates removed. Values are tested for deep equality as if by using the [equality operator](comparison-operators#equals). | ||
|
||
__Examples__ | ||
- `$distinct([1,2,3,3,4,3,5])` => `[1, 2, 3, 4, 5]` | ||
- `$distinct(Account.Order.Product.Description.Colour)` => `[ "Purple", "Orange", "Black" ]` | ||
|
||
## `$zip()` | ||
__Signature:__ `$zip(array1, ...)` | ||
|
||
Returns a convolved (zipped) array containing grouped arrays of values from the `array1` ... `arrayN` arguments from index 0, 1, 2, etc. | ||
|
||
This function accepts a variable number of arguments. The length of the returned array is equal to the length of the shortest array in the arguments. | ||
|
||
__Examples__ | ||
- `$zip([1,2,3], [4,5,6])` => `[[1,4] ,[2,5], [3,6]]` | ||
- `$zip([1,2,3],[4,5],[7,8,9])` => `[[1,4,7], [2,5,8]]` |
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 @@ | ||
--- | ||
id: version-1.7.0-boolean-functions | ||
title: Boolean functions | ||
sidebar_label: Boolean Functions | ||
original_id: boolean-functions | ||
--- | ||
|
||
## `$boolean()` | ||
__Signature:__ `$boolean(arg)` | ||
|
||
Casts the argument to a Boolean using the following rules: | ||
|
||
| Argument type | Result | | ||
| ------------- | ------ | | ||
| Boolean | unchanged | | ||
| string: empty | `false`| | ||
| string: non-empty | `true` | | ||
| number: 0 | `false`| | ||
| number: non-zero | `true` | | ||
| null | `false`| | ||
| array: empty | `false` | | ||
| array: contains a member that casts to `true` | `true` | | ||
| array: all members cast to `false` | `false` | | ||
| object: empty | `false` | | ||
| object: non-empty | `true` | | ||
| function | `false` | | ||
|
||
|
||
## `$not()` | ||
__Signature:__ `$not(arg)` | ||
|
||
Returns Boolean NOT on the argument. `arg` is first cast to a boolean | ||
|
||
## `$exists()` | ||
__Signature:__ `$exists(arg)` | ||
|
||
Returns Boolean `true` if the arg expression evaluates to a value, or `false` if the expression does not match anything (e.g. a path to a non-existent field reference). |
Oops, something went wrong.