utils Class
Exports few utility methods and constants for express-yui
components.
Item Index
Methods
- clone static
- extend static
- joinURLFolder static
- minifyFunction static
Properties
- debugMode static
- DEFAULT_COMBO_CONFIG static
Methods
clone
-
oldObj
Deep clone of an object.
Parameters:
-
oldObj
Objectthe origal object to be cloned
Returns:
The cloned object
extend
-
obj
-
supplier
Extends object with properties from other objects.
var a = { foo: 'bar' }
, b = { bar: 'baz' }
, c = { baz: 'xyz' };
utils.extends(a, b, c);
// a => { foo: 'bar', bar: 'baz', baz: 'xyz' }
Parameters:
-
obj
Objectthe receiver object to be extended
-
supplier
Objectobjects
Returns:
The extended object
joinURLFolder
-
url
Utility method to use the loader base and add the folder name that represents a group to complete the new base and root value for each custom group.
utils.joinURLFolder('http://foo.com/bar', 'baz'); // => http://foo.com/bar/baz/
utils.joinURLFolder('https://foo.com/bar', 'baz'); // => https://foo.com/bar/baz/
utils.joinURLFolder('//foo.com/bar/', 'baz'); // => //foo.com/bar/baz/
utils.joinURLFolder('/bar', 'baz'); // => /bar/baz/
Parameters:
-
url
Stringthe url that should get the new segment added at the end
Returns:
the new url
minifyFunction
-
fn
Minify the body of a function by removing spaces, tabs, comments, breaklines, etc. This is specially useful to optimize the function before serializing it to send it to the client side as a js blob.
Parameters:
-
fn
Functionthe function to minify
Returns:
the minified function
Properties
debugMode
Boolean
static
Whether the app is running in debug mode or not. True if nodejs is running in development mode.
DEFAULT_COMBO_CONFIG
Object
static
The default combo handler configuration for app origin.