lib/util

Methods

(inner) copyDirectory(source, destination)

recursively copies the content of one directory to another

Source:
Parameters:
Name Type Description
source String

path to source

destination String

path to destination

(inner) ensureDirectoryExists(directory)

ensures the given path exists, if not recursively generates folder leading to the paths

Source:
Parameters:
Name Type Description
directory String

the given path

(inner) getConfig(directory) → {Object}

retrieves a config from the given directory

Source:
Parameters:
Name Type Description
directory String

path of directory

Returns:
Type:
Object
  • config object

(inner) getTotalTimeOfDepends(item) → {Number}

recursively goes through render item to find the total time of rendered dependencies

Source:
Parameters:
Name Type Description
item Object

rendered item output by render method

Returns:
Type:
Number
  • time in milleseconds

(inner) merge(target, source) → {Object|Array}

deep merge two objects (either arrays or plain javascript objects)

Source:
Parameters:
Name Type Description
target Object | Array

an array or object, must be the same type as the other value being passed

source Object | Array

an array or object, must be the same type as the other value being passed

Returns:
Type:
Object | Array
  • an array or object, depending on what has been passed in

(inner) parse(content) → {Object}

parses the contents of a string to find the options block

Source:
Parameters:
Name Type Description
content String

file contents that could potentially contain options

Returns:
Type:
Object
  • with the attributes options and content

(inner) parseString(filePath, content) → {Object}

parses a template string for any options or content it contains

Source:
Parameters:
Name Type Description
filePath String

The file path of where the string is from, needed for includes or anything path related

content String

Template string

Returns:
Type:
Object
  • parsed template output

(inner) render(templates, template, additional) → {String}

Renders a template object, parsed by parse

Source:
Parameters:
Name Type Description
templates Object

object key template values

template Object

parsed template object

additional Object

additional data that needs to be merged into template data

Returns:
Type:
String
  • rendered template to string

(inner) renderSubDepends(item, level) → {String}

renders a dependency tree from the given render item

Source:
Parameters:
Name Type Default Description
item Object

render item

level Number 0

the level of the tree that the element is a part of (by default is 0)

Returns:
Type:
String
  • ascii representation of render tree for the given item

(inner) templateToString(templateObject) → {String}

turns a template object back into a string

Source:
Parameters:
Name Type Description
templateObject Object

template object obtained by using parseString or parse

Returns:
Type:
String
  • stringified template