Module: BaseJS

Methods

(static) isType(object, type)

Parameters:
Name Type Description
object AnyItem
type external:String
Deprecated:
  • use {module:BaseJS.type}
Source:

(static) math(name) → {external:Number}

This:
Parameters:
Name Type Description
name external:String name of Math Function
Source:
Tutorials:
See:
Returns:
Type
external:Number
Example
Crisp.math.call( -1, 'abs'); // 1

(static) ns(name, objopt) → {AnyItem}

managed Crisp Namespace
This:
Parameters:
Name Type Attributes Description
name external:String Dot seperatet Namespace-Path
obj AnyItem <optional>
Any type of Objects
Source:
Tutorials:
Returns:
node of Namespace
Type
AnyItem
Example
// GET
Crisp.ns('a'); // return reference of a = {}

// SET and GET
Crisp.ns('b', { a: 'A' }); // return reference of b = { a: 'A' }

(static) parse(type) → {AnyItem}

parse data format
This:
Parameters:
Name Type Default Description
type external:String "json"
Source:
Tutorials:
Returns:
JavaScript Objects
Type
AnyItem
Example
Crisp.parse.call('"a"'); // 'a'
Crisp.parse.call('{"a":"A"}'); // { a: 'A' }

(static) parseJson() → {AnyItem}

parse this.toString() to JavaScript Objects
This:
Deprecated:
Source:
Tutorials:
Returns:
JavaScript Objects
Type
AnyItem
Examples

create a copy of module:BaseJS with AnyItem

Crisp.parseJson(); 

parse AnyItem to external:String and crate a new JavaScript object of AnyItem

Crisp.parseJson.call('{"a":"A"}'); // { "a": "A" }

(static) to(type) → {external:String}

create specified data format
This:
Parameters:
Name Type Default Description
type external:String "json"
Source:
Tutorials:
Returns:
converted JavaScript Object
Type
external:String
Example
Crisp.to.call('a'); // '"a"'
Crisp.to.call({ a: 'A' }); // '{"a":"A"}'

(static) toJson(prity) → {external:String}

create JSON data format
This:
Parameters:
Name Type Default Description
prity external:Boolean false
Deprecated:
Source:
Tutorials:
Returns:
converted JavaScript Object
Type
external:String

(static) toMath(name) → {external:Number}

This:
Parameters:
Name Type Description
name external:String name of Math Function
Deprecated:
  • Yes
Source:
Tutorials:
See:
Returns:
Type
external:Number
Example
Crisp.toMath.call( -1, 'abs'); // 1

(static) toType(object)

Parameters:
Name Type Description
object AnyItem
Deprecated:
  • use {module:BaseJS.type}
Source:

(static) type(typeopt) → {external:Boolean|external:String}

get or check ths small type name of objects
This:
Parameters:
Name Type Attributes Description
type external:String <optional>
Source:
Tutorials:
Returns:
Type
external:Boolean | external:String
Example
// GET the small type name of JavaScript objects
Crisp.type.call( '' );          // 'String'
Crisp.type.call( 0 );           // 'Number'
Crisp.type.call( true );        // 'Boolean'
Crisp.type.call( new Date() );  // 'Date'
Crisp.type.call( {} );          // 'Object'
Crisp.type.call( [] );          // 'Array'
Crisp.type.call( /a/g );        // 'RegExp'

Crisp.type.call( null );        // 'Undefined'
Crisp.type.call( undefined );   // 'Undefined'

// CHECK the small type name of JavaScript objects
Crisp.type.call( '',         'String' );     // true
Crisp.type.call( 0,          'Number' );     // true
Crisp.type.call( true,       'Boolean' );    // true
Crisp.type.call( new Date(), 'Date' );       // true
Crisp.type.call( {},         'Object' );     // true
Crisp.type.call( [],         'Array' );      // true
Crisp.type.call( /a/g,       'RegExp' );     // true

Crisp.type.call( null,       'Undefined' );  // true
Crisp.type.call( undefined,  'Undefined' );  // true

// CHECH group of object type
Crisp.type.call(         '', 'field' );  // true
Crisp.type.call(          0, 'field' );  // true
Crisp.type.call(       true, 'field' );  // true
Crisp.type.call( new Date(), 'field' );  // true
Crisp.type.call(       /a/g, 'field' );  // true

(static) utilTick(selfopt, callback, optopt, asyncopt) → {self}

execute function with (async) util.utilTickCall
This:
Parameters:
Name Type Attributes Default Description
self external:Object <optional>
opt.self alternate of opt.self and return param
callback util.utilTickCallback Function for apply
opt external:Object <optional>
Options for apply
Properties
Name Type Attributes Description
self AnyItem <optional>
thisArg of apply
args AnyItem <optional>
Arguments for apply
async external:Boolean <optional>
false Asynchronus apply
Deprecated:
  • change to Crisp.utilTack( opt, success, complete )
Source:
Tutorials:
Returns:
Type
self
Examples

synchronous execution of an anonymous function

Crisp.utilTick({ a: 'A' }, function() {
  console.log(this);
});
console.log('end');
// logs:
// { "a": "A" }
// end

asynchronous exetution of an named function

function test( b ) {
  console.log( b.c );
}

Crisp.utilTick( { a: 'A' }, test, { args: 'C' }, true );
console.log('end');
// logs:
// end
// { "a": "A" }