top

CAPH.LANG

Lang is an object which provides various kinds of methods related to JavaScript language. Lang includes isNumber, isBoolean, isFunction, isChildOf, isElement and so on. Using isNumber method, a user can tell if the type of a variable is Number or not. Using isBoolean method, a user can tell if the type of a variable is Boolean or not. Using isFunction method, a user can tell if the type of a variable is Function or not. Using isChildOf method, a user can checks whether matched element is a descendant of the specific parent element. Also, using isHTMLElement method, a user can check whether its arguments is a HTMLElement.


Methods

isArray

Description
Checks whether its arguments is a array.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isArray(a)) {
    doSomething(a);
  }
}

isBoolean

Description
Checks whether its arguments is a boolean.
Parameters
■value
  - Object
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isBoolean(a)) {
    doSomething(a);
  }
}

isChildOf

Description
Checks whether matched element is a descendant of the specific parent element
Parameters
■element
  - Object
  - The element to be checked as child element
■parent
  - Object
  - The element to be checked as parent element
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isChildOf(a, b)) {
    doSomething(a);
  }
}

isHTMLElement

Description
Checks whether its arguments is a HTMLElement.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isHTMLElement(a)) {
    doSomething(a);
  }
}

isNull

Description
Checks whether its arguments is a null.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isNull(a)) {
    doSomething(a);
  }
}

isNumber

Description
Checks whether its arguments is a number.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isNumber(a)) {
    doSomething(a);
  }
}

isObject

Description
Checks whether its arguments is a object.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isObject(a)) {
    doSomething(a);
  }
}

isPlainObject

Description
Checks whether its arguments is a plainObject.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isPlainObject(a)) {
    doSomething(a);
  }
}

isRegularExpression

Description
Checks whether its arguments is a RegExp.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isRegularExpression(a)) {
    doSomething(a);
  }
}

isString

Description
Checks whether its arguments is a string.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isString(a)) {
    doSomething(a);
  }
}

isUndefined

Description
Checks whether its arguments is a undefined.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
function foo(a) {
  if(caph.Lang.isUndefined(a)) {
    doSomething(a);
  }
}

isFunction

Description
Checks whether its arguments is a function.
Parameters
■value
  - Object 
  - The Object to be checked its type
Return■Boolean
  - true : if it is
  - false : otherwise.
Emulator SupportY
SDK Constraintnone
Example
var myWidget = new MyWidget();
  if(caph.Lang.isFunction(myWidget.doSomething)){
    myWidget.doSomething("hello")
  }
}

camelCase

Description
Returns the input applied camelcase naming convention
Parameters
■input
  - String 
  - The input to be applied camelcase
Return■String
  - camelCase String
Emulator SupportY
SDK Constraintnone
Example
var str = 'hello-world';
var output = caph.Lang.camelCase(str);
console.log(output); // Displays 'helloWorld'