Permalink
Fetching contributors…
Cannot retrieve contributors at this time
88 lines (46 sloc) 1.96 KB

utils

miscellaneous utilities

Methods

utils.getHttpProxy( hostname )

    Describe: Get the system's http proxy


utils.isRelativeURI(uri)

    Describe: Is a relative URI?

    Example:

```js utils.isRelativeURI("../path/to"); // => return true utils.isRelativeURI("path/to"); // => return true utils.isRelativeURI("#id"); // => return false utils.isRelativeURI("http://www.qq.com"); // => return false utils.isRelativeURI("/relative/to/root"); // => return false utils.isRelativeURI("//without/protocol"); // => return false utils.isRelativeURI("data:image/gif;base64,lGODlhEAA..."); // => return false ```

utils.download(url, local, callback)

    Describe: Download file


utils.isPlainObject(obj)

    Describe: Check to see if an object is a plain object (created using “{}” or “new Object”).


utils.clone(obj)

    Describe: Deep copy of the object


utils.walk(value, fn, fnContinue)

    Describe: Recurse through objects and arrays, executing fn for each non-object.


utils.namespace(obj, parts, create)

    Describe: Get the value of a deeply-nested property exist in an object.


utils.merge(a, b)

    Describe: Deep merge for JSON objects, overwrites conflicting properties


utils.arrayify()

    Describe: Convert 'a,b,c' to [a,b,c]


utils.getVersion()

    Describe: Reads the version property from modjs's package.json


utils.open(target, appName, callback)

    Describe: Open application