ti-util
A TI helper/util library for node.js and Node-Webkit
This utility includes many functions that a developer may find useful
Installation
npm install git@gitorious.design.ti.com:guicomposer-nw/guicomposer-nw/node-modules/ti-util.git
Usage
The ti-util module .
var tiutil = require('ti-util');
if(tiutil.isString(myVariable))
{
...
}
List of functions
ti-util includes the following helper functions:
· getUserHome
· tiDirectoryHome
· getArguments
· getEnv
· isNodeWebkitApp
· getNodeWebkitVersion
· getAppName
· getAppVersion
· getAppDataDirectory
· getLocalAppDataDirectory
· getUserTempDirectory
· getUserName
· getComputerName
· getOS
· isWindows
· isLinux
· isMac
· isString
· isFunction
· isNumber
· isBoolean
· isDefined
· isEmpty
· isUndefined
· isObject
· isDate
· isError
· isRegExp
· isArray
· isRealObject
· isJSON
Functions Details
· getUserHome : returns the user home directory
· tiDirectoryHome : returns TI directory under the user Home directory
· getArguments : returns the argumments of the command that started the application
· getEnv : Returns an object containing all the environment variable and their values
· isNodeWebkitApp : returns true if the running app is a Node-Webkit app
· getNodeWebkitVersion : returns the version of nw
· getAppName : returns the name of the application as defined in application.json of the running app.
· getAppVersion : return the version of the application as defined in application.json of the running app.
· getAppDataDirectory : returns the APPData directory
· getLocalAppDataDirectory : returns the local APPData directory
· getUserTempDirectory : returns the user temporary directory
· getUserName : returns the username
· getComputerName : returns the computer name
· getOS : returns a string with the os name
· isWindows : returns true if the os is windows
· isLinux : returns true if the os is linus
· isMac : returns true if the os is Mac
· isString : returns true if the argument is a String
· isFunction : returns true if the argument is a function
· isNumber : returns true if the argument is a number
· isBoolean : returns true if the argument is a Boolean
· isDefined : returns true if the argument not set to undefined
· isEmpty : returns true if the argument is not empty
· isUndefined : returns true if the argument is set to undefined
· isObject : returns true if the argument is an Object
· isDate : returns true if the argument is a Date
· isError : returns true if the argument is an Error
· isRegExp : returns true if the argument is a RegExp
· isArray : returns true if the argument is an Array
· isRealObject : returns true if the argument is a Real Object. This mean an Object that is not a String or a function, or a boolean, etc
· isJSON : returns true if the argument is a valid JSON String