Cocos2D JavaScript (v0.1) API Documentation

  • util

Namespace: util

Module
Global
Defined In
libs/util.js
Useful utility functions

Public Methods

Method Defined By
Expand beget beget (o:*) : void <static>

Arguments

  1. o :

Returns

  • void
util
Expand callback callback (target:*,method:*) : void <static>

Arguments

  1. target :
  2. method :

Returns

  • void
util
Expand copy copy (obj:Object) : Object <static>
Creates a deep copy of an object

Arguments

  1. obj : Object
    The Object to copy

Returns

  • A copy of the original Object
util
Expand domReady domReady () : void <static>

Returns

  • void
util
Expand each each (arr:Array,func:Function) : Array <static>
Iterates over an array and calls a function for each item.

Arguments

  1. arr : Array
    An Array to iterate over
  2. func : Function
    A function to call for each item in the array

Returns

  • Array
    The original array
util
Expand extend extend (target:*,ext:*) : void <static>

Arguments

  1. target :
  2. ext :

Returns

  • void
util
Expand isArray isArray (ar:Array) : Boolean <static>
Tests if a given object is an Array

Arguments

  1. ar : Array
    The object to test

Returns

  • Boolean
    True if it is an Array, otherwise false
util
Expand isDate isDate (ar:Date) : Boolean <static>
Tests if a given object is a Date

Arguments

  1. ar : Date
    The object to test

Returns

  • Boolean
    True if it is an Date, otherwise false
util
Expand isRegExp isRegExp (ar:RegExp) : Boolean <static>
Tests if a given object is a RegExp

Arguments

  1. ar : RegExp
    The object to test

Returns

  • Boolean
    True if it is an RegExp, otherwise false
util
Expand map map (arr:Array,func:Function) : Array <static>
Iterates over an array, calls a function for each item and returns the results.

Arguments

  1. arr : Array
    An Array to iterate over
  2. func : Function
    A function to call for each item in the array

Returns

  • Array
    The return values from each function call
util
Expand merge merge (firstObject:Object,secondObject:Object{[:Object]}) : Object <static>
Merge two or more objects and return the result.

Arguments

  1. firstObject : Object
    First object to merge with
  2. secondObject : Object
    Second object to merge with

Named Arguments

  • : Object (Optional)
    More objects to merge

Returns

  • A new object containing the properties of all the objects passed in
util
Expand populateIndex populateIndex (parent:Object,modules:String) : Object <static>
Utility to populate a namespace's index with its modules

Arguments

  1. parent : Object
    The module the namespace lives in. parent.exports will be populated automatically
  2. modules : String
    A space separated string of all the module names

Returns

util
Expand ready ready (func:*) : void <static>

Arguments

  1. func :

Returns

  • void
util

Private Members

This namespace has no private members.