External: Array

Array

Methods

xAdd(…item) → {module:EventJS}

add one or more items/arrays for concat in Array. empty Arrays and undefined items are ignored
This:
  • module:EventJS
Parameters:
Name Type Attributes Description
item AnyItem <repeatable>
one or more of args
Source:
Returns:
Type
module:EventJS
Example
// standard
[].xAdd('a'); // ['a']
[].xAdd( 'a', 'b' ); // ['a','b']
[].xAdd([ 'a', 'b' ]); // ['a','b']
[].xAdd(['a'], ['b']); // ['a','b']

// empty items
[].xAdd(); // []
[].xAdd([]); // []
[].xAdd(['a'], []); // ['a']

// undefined items
[].xAdd( undefined ); // []
[].xAdd( undefined, 'b' ); // ['b']
[].xAdd([ 'a', undefined ]); // ['a']
[].xAdd(['a'], [ undefined ]); // ['a']

xEach(option) → {external:Array}

call of each Array items with (async) Crisp.utilTick and execute option.success and/or option.complete with (async) Crisp.utilTick
This:
Parameters:
Name Type Description
option external:Object
Properties
Name Type Attributes Default Description
success util.utilTickCallback callback function for execute each item with (async) Crisp.utilTick
self AnyItem <optional>
use Object for .call() the option.success an option.complete function
complete util.utilTickCallback <optional>
callback function for exeute on the end of xEach with (async) Crisp.utilTick
async external:Boolean <optional>
enable asynchronus for call of each Array items with (async) Crisp.utilTick
start external:Number <optional>
0 start index of each
limit external:Number <optional>
length limit items of each
Source:
Tutorials:
Returns:
Type
external:Array
Examples
['A','B'].xEach({
  success: function( item, index ) {
    // return; got to the next item 
    // throw new Break(); stop each of items
    console.log('success:', index, item );
  },
  complete: function() {
    console.log('complete');
  }
});
console.log('end');
// logs:
// success: 0 A
// success: 1 B
// complete
// end
// async
['A','B'].xEach({
  async: true,
  success: function( item, index ) {
    console.log('success:', index, item );
  },
  complete: function() {
    console.log('complete');
  }
});
console.log('end');
// logs:
// end
// success: 0 A
// success: 1 B
// complete

xTo(typeopt) → {external:String}

This:
Parameters:
Name Type Attributes Default Description
type external:String <optional>
"json"
Implements:
Source:
Returns:
Type
external:String
Example
['a'].xTo(); // '["a"]'