Module: utils

utils

Methods

delFromCache(key, scope) → {Undefined}

Removes value from cache
Parameters:
Name Type Argument Description
key String Hash key
scope Object <optional>
Scope instance
Source:
Returns:
Undefined
Type
Undefined

flushCache(scope) → {Object}

Cache annihilation
Parameters:
Name Type Argument Description
scope Object <optional>
Scope instance
Source:
Returns:
Empty object
Type
Object

freeCacheSpace(scope, space) → {number}

Frees up memory of scope cache
Parameters:
Name Type Argument Description
scope object <optional>
Scope instance
space number <optional>
Target free space
Source:
Returns:
Type
number

getCache(scope) → {Object}

Returns/creates scope cache
Parameters:
Name Type Argument Description
scope Object <optional>
Scope instance
Source:
Returns:
Scope.cache object
Type
Object

getCacheRest(scope) → {number}

Returns free cache space in bytes
Parameters:
Name Type Argument Description
scope Object <optional>
Scope instance
Source:
Returns:
Type
number

getCacheScope() → {Object}

Returns cache scope for specified object
Source:
Returns:
Scope
Type
Object

getCacheSize(scope) → {number|undefined}

Returns cache size (in bytes) of specified scope
Parameters:
Name Type Argument Description
scope Object <optional>
Scope instance
Source:
Returns:
Type
number | undefined

getDefaultCacheScope() → {Object}

Returns default cache scope
Source:
Returns:
Scope
Type
Object

getFromCache(key, scope) → {*}

Gets cached value
Parameters:
Name Type Argument Description
key String Hash key
scope Object <optional>
Scope instance
Source:
Returns:
value
Type
*

isx64() → {boolean}

Detects x64
Source:
Returns:
Type
boolean

replace(a, b, c) → {String|Array}

Smart replace
Parameters:
Name Type Description
a String | Array Replace in
b * 1st arg
c * 2nd arg
Source:
Returns:
Replace output
Type
String | Array

setCacheSize(size, scope, isx64) → {number}

Sets cache size (in bytes) of scope
Parameters:
Name Type Argument Description
size number <optional>
Size in bytes
scope object <optional>
Scope instance or default scope
isx64 boolean <optional>
x64
Source:
Returns:
Type
number

setToCache(key, val, scope) → {*}

Stores value to the cache
Parameters:
Name Type Argument Description
key String Hash key
val * Hash value
scope Object <optional>
Scope instance
Source:
Returns:
val param as is
Type
*

sizeOf(object) → {Number}

A function to calculate the approximate memory usage of objects
Parameters:
Name Type Description
object * Measurable object
Author:
  • Stephen Morley - http://code.stephenmorley.org/
Source:
Returns:
Size in bytes
Type
Number

sortBy(list, param, attr, withExceptions) → {Array|*}

_.sortBy extension for Handlebars Helpers
Parameters:
Name Type Argument Description
list Array Array of anything
param function | String <optional>
Fn or static method name as iterator
attr String <optional>
Object attr name for iterator
withExceptions Boolean <optional>
Enables sorter injection
Source:
Returns:
Sorted array or list param as is
Type
Array | *
Example
Handlebars: {{#sortBy this 'toLocaleString' null true}}

strictBool(param, def) → {boolean}

Returns strict boolean value or default or false
Parameters:
Name Type Argument Description
param * <optional>
Param value
def Boolean <optional>
Default value or false
Source:
Returns:
Type
boolean