frontend/express/libs/express-expose

Module to expose objects to template

Description:
  • Module to expose objects to template

Source:

Members

(inner) _name

Description:
  • Default local variable name.

Source:

Default local variable name.

(inner) _namespace

Description:
  • Default namespace.

Source:

Default namespace.

Methods

(inner) escape_html(str) → {string}

Description:
  • Escape special characters in the given string of html.

Source:
Parameters:
Name Type Description
str string

The string to escape for inserting into HTML

Returns:

escaped string

Type
string

(inner) expose(obj, namespace, name) → {HTTPServer}

Description:
  • Expose the given obj to the client-side, with an optional namespace defaulting to "express".

Source:
Parameters:
Name Type Description
obj Object | String | function

object to expose

namespace String

namespace for exposing

name String

name of the key

Returns:

for chaining

Type
HTTPServer

(inner) exposed(name) → {String}

Description:
  • Render the exposed javascript.

Source:
Parameters:
Name Type Description
name string

name of exposed value

Returns:

exposed value

Type
String

(inner) renderNamespace(str) → {String}

Description:
  • Render a namespace from the given str.

Source:
Example
renderNamespace('foo.bar.baz');

   var foo = foo || {};
   foo.bar = foo.bar || {};
   foo.bar.baz = foo.bar.baz || {};
Parameters:
Name Type Description
str String

namespace name

Returns:

rendered string to be used in source

Type
String

(inner) renderObject(obj, namespace) → {String}

Description:
  • Render obj with the given namespace.

Source:
Parameters:
Name Type Description
obj Object

object to render

namespace String

render ybder provided namespace

Returns:

rendered object

Type
String

(inner) string(obj) → {String}

Description:
  • Return a string representation of obj.

Source:
Parameters:
Name Type Description
obj Mixed

object to stringify

Returns:

stringified object

Type
String