update/fix documentation
This commit is contained in:
parent
e348acee86
commit
d9b0cc5f01
2 changed files with 40 additions and 5 deletions
|
@ -30,7 +30,7 @@ Ox.List <f> List constructor
|
|||
draganddropenter <!> Fires when entering an item during drag
|
||||
draganddropleave <!> Fires when leaving an item during drag
|
||||
draganddroppause <!> Fires when the mouse stops during drag
|
||||
draganddropstart <i> Fires when drag starts
|
||||
draganddropstart <!> Fires when drag starts
|
||||
copy <!> copy
|
||||
paste <!> paste
|
||||
move <!> move item
|
||||
|
|
|
@ -4,15 +4,50 @@
|
|||
Ox.api <f> Turns an array into a list API
|
||||
`Ox.api` takes an array and returns a function that allows you to run
|
||||
complex queries against it. See the examples below for details.
|
||||
(items, options) -> <f> List API
|
||||
items <[o]> An array of objects (key/value stores)
|
||||
options <o> Options object
|
||||
options <o> API Options
|
||||
cache <b|false> If true, cache results
|
||||
enums <o> Enumerables, for example `{size: ['S', 'M', 'L']}`
|
||||
geo <b|false> If true, return combined area with totals
|
||||
sort <[o]|[s]> Default sort, for example `['+name', '-age']`
|
||||
sums <[s]> List of keys to be included in totals
|
||||
unique <s|'id'> The name of the unique key
|
||||
(items, options) -> <f> List API
|
||||
(options) -> <o> Results
|
||||
(options, callback) -> <o> Results
|
||||
area <o> Combined area
|
||||
Present if `keys` was undefined and the `geo` option was set
|
||||
east <n> Longitude
|
||||
north <n> Latitude
|
||||
south <n> Latitude
|
||||
west <n> Longitude
|
||||
items <n|[o]> Number of items or array of items
|
||||
Present if `positions` was not passed. Number if `keys` was
|
||||
undefined, otherwise array
|
||||
positions <o> Position (value) for each id (key)
|
||||
Present if `positions` was passed
|
||||
* <n> Sum of the values of any key specified in `sums`
|
||||
Present if `keys` was undefined
|
||||
options <o> Request options
|
||||
keys <[s]> Array of keys to be returned, or empty array for all keys
|
||||
Leaving `keys` undefined returns totals, not items
|
||||
positions <[s]> Array of ids
|
||||
Passing `positions` returns positions, not items
|
||||
query <o> Query object
|
||||
conditions <[o]> Array of condition objects and/or query objects
|
||||
Passing a query object instead of a condition object inserts
|
||||
a subcondition
|
||||
key <s> Key
|
||||
operator <s> Operator, like `'='` or `'!='`
|
||||
Can be `'='` (contains) `'=='` (is), `'^'` (starts
|
||||
with), `'$'` (ends with), `'<'`, `'<='`, `'>'`, `'>='`,
|
||||
optionally prefixed with `'!'` (not)
|
||||
value <*> Value
|
||||
operator <s> `'&'` or `'|'`
|
||||
range <[n]> Range of results, like `[100, 200]`
|
||||
sort <[s]> Array of sort strings, like `['+name', '-age']`
|
||||
callback <f> Callback function
|
||||
results <o> Results
|
||||
<script>
|
||||
Ox.test.api = Ox.api([
|
||||
{id: 'foo', n: 2},
|
||||
|
@ -290,8 +325,8 @@ Ox.api = function(items, options) {
|
|||
'<=': function(a, b) { return a <= b; },
|
||||
'>': function(a, b) { return a > b; },
|
||||
'>=': function(a, b) { return a >= b; },
|
||||
'^': function(a, b) { return Ox.starts(a, b); },
|
||||
'$': function(a, b) { return Ox.ends(a, b); }
|
||||
'^': function(a, b) { return Ox.startsWith(a, b); },
|
||||
'$': function(a, b) { return Ox.endsWith(a, b); }
|
||||
};
|
||||
if (Ox.isString(itemValue)) {
|
||||
itemValue = itemValue.toLowerCase();
|
||||
|
|
Loading…
Reference in a new issue