Namespace: Helper

AJL. Helper

Source:

Methods

<static> attachEvent(obj, type, fn)

Attach event to object
Parameters:
Name Type Description
obj * Object on which need attach event
type string Type of event
fn function Function of event
Source:
Example
AJL.Helper.attachEvent(window, 'load', function() {
     console.log("Page is loaded");
});

<static> classType(obj) → {String}

Get type of obj in string
Parameters:
Name Type Description
obj * Variable from which need get type
Source:
Returns:
Type of variable
Type
String
Example
AJL.Helper.classType(['Hi', 'I am array']);

<static> detachEvent(obj, type, fn)

Detach event from object
Parameters:
Name Type Description
obj * Object where event assigned
type string Type of event
fn function Function of event
Source:
Example
AJL.Helper.detachEvent(window, 'load', function() {
     console.log('Removed');
});

<static> each(obj, callback) → {Array|Object|Collection}

Iterate through object
Parameters:
Name Type Description
obj Array | Object | Collection Object where need to iterate
callback function Function which will working while iterate
Source:
Returns:
Type
Array | Object | Collection
Example
AJL.Helper.each({
     foo: 'foo',
     bar: 'bar'
}, function(key, value) {
     console.log(key, value);
});

<static> extend(target, object) → {Object|Collection}

Extend object
Parameters:
Name Type Description
target Array | Collection | Object Target
object Array | Collection | Object From which object extend target
Source:
Returns:
Resulting object
Type
Object | Collection
Example
AJL.Helper.extend({
     foo: 'foo'
}, {
     bar: function() {
         console.log("I'm a bar function");
     }
});

<static> getExtension(fileName) → {String}

Get extension of filename
Parameters:
Name Type Description
fileName String Filename from which we need get extension
Source:
Returns:
Extension of file
Type
String
Example
AJL.Helper.getExtension('SomeFileName.js');

<static> isArray(obj) → {boolean}

Check if variable it is array
Parameters:
Name Type Description
obj What need check
Source:
Returns:
True if it's array
Type
boolean
Example
AJL.Helper.isArray("No, it's not");

<static> isCssFile(url) → {Boolean}

Check if this file has css-extensions
Parameters:
Name Type Description
url String URL of file that need to check
Source:
Returns:
True if is css file
Type
Boolean
Example
AJL.Helper.isCssFile('SomeStyles.css');

<static> isEmpty(param) → {Boolean}

Is variable empty or not
Parameters:
Name Type Description
param * Variable which need check
Source:
Returns:
True if empty
Type
Boolean
Example
AJL.Helper.isEmpty([]);

<static> isExistsInArray(val, arr) → {boolean}

Check if value exists in array
Parameters:
Name Type Description
val Value which we search
arr Array where we search
Source:
Returns:
True if exists and false if not
Type
boolean
Example
AJL.Helper.isExistsInArray('My Value', [
     'First Value',
     'My Value',
     'Second Value'
]);

<static> isFunction(obj) → {boolean}

Check if it is function
Parameters:
Name Type Description
obj * What need check
Source:
Returns:
True if this function
Type
boolean
Example
AJL.Helper.isFunction(function() {
     console.log("Yes, it's function");
});

<static> isInstanceOf(instance, obj) → {boolean}

Check if variable instanceof of object
Parameters:
Name Type Description
instance * Instance that need to check
obj * Object or Function
Source:
Returns:
True if Instance instanceof Obj
Type
boolean
Example
AJL.Helper.isInstanceOf(myPackage, AJL.Package);

<static> isObject(obj) → {boolean}

Check if it is object
Parameters:
Name Type Description
obj Object which need check
Source:
Returns:
True if this object
Type
boolean
Example
AJL.Helper.isObject(['No', 'Not object']);

<static> isScriptFile(url) → {Boolean}

Check if this file has js-extensions
Parameters:
Name Type Description
url String URL of file that need to check
Source:
Returns:
True if is script file
Type
Boolean
Example
AJL.Helper.isScriptFile('MyScript.js');

<static> isString(param) → {boolean}

Check if variable it is string type
Parameters:
Name Type Description
param * What need check
Source:
Returns:
True if this string
Type
boolean
Example
AJL.Helper.isString("Yes, it's string");

<static> isUndefined(param) → {Boolean}

Is variable undefined
Parameters:
Name Type Description
param * Variable which need check
Source:
Returns:
True if undefined or null
Type
Boolean
Example
AJL.Helper.isUndefined(undefined);

<static> isWindow(obj) → {boolean}

Check if variable it is global scope - window object
Parameters:
Name Type Description
obj What need check
Source:
Returns:
True if this window
Type
boolean
Example
AJL.Helper.isWindow({
     no: 'not window object'
});