The core
package is specialized in functions utilities that are highly reusable without creating any dependencies : arrays, strings, chars, objects, numbers, maths, date, colors, etc.
You can consider a library as a set of functions organized into classes, here with a "core" library in some cases we organize the functions in the package definitions without assembling them into a class.
Those functions are allowed to reuse the builtin types (Object, Array, Date, etc.), the Javascript API classes and packages, but nothing else.
Namespaces
- arrays
- The
core.arrays
package is a modular JavaScript library that provides extraArray
methods. - chars
- The
core.chars
package is a modular JavaScript library that provides extraString
methods to validate and transform a basic character. - colors
- The
core.colors
package is a modular JavaScript library that provides extra rgb color methods. - date
- The
core.date
package is a modular JavaScript library that provides extraDate
methods. - easings
- The
core.easings
library contains all the easing functions to create the specific tweening effects. - functors
- The
core.functors
package is a modular JavaScript library that provides extraFunction
methods. - maths
- The
core.maths
package is a modular JavaScript library that provides extramathematics
methods and implementations. - numbers
- The
core.numbers
package is a modular JavaScript library that provides extraNumber
methods and implementations. - objects
- The
core.objects
package is a modular JavaScript library that provides extraObject
methods and implementations. - random
- The
core.objects
package is a modular JavaScript library that provides extra methods to generates a random number. - reflect
- The
core.reflect
package is a modular JavaScript library that provides extra methods to to obtain information about loaded objects or generate it. - strings
- The
core.strings
package is a modular JavaScript library that provides extraString
methods.
Members
-
<constant> global
-
The
global
namespace (reference to the global scope of the application), this object can target thewindow
or thedocument
global objects in the browser or an other global reference.
Methods
-
cancelAnimationFrame(requestID)
-
Cancels an animation frame request previously scheduled through a call to requestAnimationFrame.
Parameters:
Name Type Description requestID
number The ID value returned by the call to requestAnimationFrame that requested the callback.
Example
var start = performance.now() ; var id ; function step( timestamp ) { var progress = timestamp - start; console.log( 'step: ' + progress ) ; if (progress < 2000) { id = requestAnimationFrame(step); } } id = requestAnimationFrame(step); cancelAnimationFrame(id); // abord the animation
-
dump(value [, prettyprint] [, indent] [, indentor=])
-
Dumps a string representation of any object reference.
Parameters:
Name Type Argument Default Description value
* Any object to dump.
prettyprint
boolean <optional>
false boolean option to output a pretty printed string
indent
number <optional>
0 initial indentation
indentor=
string <optional>
initial string used for the indent.
Returns:
The string expression of the dump.
Example
var object ={ name : "vegas" , count : 10 , time : new Date() , flag : true , values : [1,2,3]} ;trace( dump( object ) ) ;
-
dumpArray(value [, prettyprint] [, indent] [, indentor=])
-
Dumps a string representation of any Array reference.
Parameters:
Name Type Argument Default Description value
Array The Array to dump.
prettyprint
boolean <optional>
false boolean option to output a pretty printed string
indent
number <optional>
0 initial indentation
indentor=
string <optional>
initial string used for the indent.
Returns:
The dump string representation of any Array reference.
-
dumpDate(value [, timestamp])
-
Dumps a string representation of any Date reference.
Parameters:
Name Type Argument Default Description value
Date A Date object to dump.
timestamp
boolean <optional>
false The optional timestamp flag.
Returns:
The string representation of any Date reference.
-
dumpObject(value [, prettyprint] [, indent] [, indentor=])
-
Dumps a string representation of an object.
Parameters:
Name Type Argument Default Description value
Object An object to dump.
prettyprint
boolean <optional>
false The option to output a pretty printed string.
indent
number <optional>
0 The initial indentation value.
indentor=
string <optional>
The initial string used for the indent.
Returns:
The string expression of the dump.
-
dumpString(str)
-
Dumps a string representation of any String value.
Parameters:
Name Type Description str
string a String to transform.
Returns:
The dump string representation of any String value.
-
isBoolean(object)
-
Indicates if the specific object is a Boolean.
Parameters:
Name Type Description object
Object The object to check.
Returns:
true
if the object is a Boolean.- Type
- boolean
Example
trace( isBoolean(0) ) ; // false trace( isBoolean(true) ) ; // true trace( isBoolean(false) ) ; // true trace( isBoolean(3>2) ) ; // true trace( isBoolean(null) ) ; // false
-
isFloat(value)
-
Indicates if an value is a float number.
Parameters:
Name Type Description value
number The value to evaluates.
Returns:
true
if the passed-in value is a float.Example
trace( isFloat(0) ) ; // false trace( isFloat(0.5) ) ; // true trace( isFloat(1) ) ; // false
-
isInt(value)
-
Indicates if an value is an integer.
Parameters:
Name Type Description value
number The value to evaluates.
Returns:
true
if the passed-in value is an integer.Example
trace( isInt(-1) ) ; // true trace( isInt(0) ) ; // true trace( isInt(0.5) ) ; // false trace( isInt(1) ) ; // true
-
isNumber(object)
-
Indicates if the specific object is a Number.
Parameters:
Name Type Description object
Object The object to check.
Returns:
true
if the object is a Number.- Type
- boolean
Example
trace( isNumber(0) ) ; // true trace( isNumber(0.5) ) ; // true trace( isNumber(true) ) ; // true trace( isNumber(null) ) ; // false trace( isNumber(NaN) ) ; // true
-
isString(object)
-
Indicates if the specific object is a String.
Parameters:
Name Type Description object
Object The object to check.
Returns:
true
if the object is a String.Example
trace( isString(0) ) ; // false trace( isString(true) ) ; // false trace( isString(null) ) ; // false trace( isString('hello') ) ; // true trace( isString(new String('hello')) ) ; // true
-
isUint(value)
-
Indicates if an value is an upper integer.
Parameters:
Name Type Description value
number The value to evaluates.
Returns:
true
if the passed-in value is an upper integer.Example
trace( isUint(-1) ) ; // false trace( isUint(0) ) ; // true trace( isUint(0.5) ) ; // false trace( isUint(1) ) ; // true
-
requestAnimationFrame(callback)
-
The
requestAnimationFrame()
method tells the browser that you wish to perform an animation and requests that the browser call a specified function to update an animation before the next repaint. The method takes as an argument a callback to be invoked before the repaint.Parameters:
Name Type Description callback
function A parameter specifying a function to call when it's time to update your animation for the next repaint. The callback has one single argument, a
DOMHighResTimeStamp
, which indicates the current time (the time returned fromPerformance.now()
) for when requestAnimationFrame starts to fire callbacks.Returns:
A long integer value, the request id, that uniquely identifies the entry in the callback list. This is a non-zero value, but you may not make any other assumptions about its value. You can pass this value to window.cancelAnimationFrame() to cancel the refresh callback request.
- Type
- number
Example
var start = performance.now() ; function step( timestamp ) { var progress = timestamp - start; console.log( 'step: ' + progress ) ; if (progress < 2000) { id = requestAnimationFrame(step); } } var id = requestAnimationFrame(step);