-
Notifications
You must be signed in to change notification settings - Fork 0
ds.transforms
metmajer edited this page Mar 15, 2013
·
3 revisions
The ds.transforms
module is a collection of functions for transforming a pair of values x
and y
into an arbitrary data structure.
pair(x, y)
Transforms a pair of values x
and y
into an array [x, y]
.
ds.transforms.pair(1, 0);
// => [0, 1]
ds.generators.f(ds.functions.identity)
.inputs(ds.range(2))
.transform(ds.transforms.pair)
.values();
// => [[0, 0], [1, 1], [2, 2]]
-
* x
-
* y
- Array Returns the transformed values.
point(x, y)
Transforms a pair of values x
and y
into an object {x: x, y: y}
.
ds.transforms.point(1, 0);
// => {x: 0, y: 1}
ds.generators.f(ds.functions.identity)
.inputs(ds.range(2))
.transform(ds.transforms.point)
.values();
// => [{x: 0, y: 0}, {x: 1, y: 1}, {x: 2, y: 2}]
-
* x
-
* y
- Object Returns the transformed values.