Fireball Engine API

Fireball is the game engine for the future.

utils Module

Defined in: lib/locals.js:13

Utilities modules

Class

Direct Members

Methods:

escapeHTML
(
  • html
)
String

Provided by the utils module.

Defined in lib/utils.js:22

Escapes HTML characters in html.

parameters:

  • html String
    String to escape.

returns:

type: String

Escaped string.

safetrim
(
  • str
)
String

Provided by the utils module.

Defined in lib/utils.js:36

Trim in safe mode

parameters:

  • str String

returns:

type: String

trimed string or other types if invalid

unindent
(
  • content
)
String

Provided by the utils module.

Defined in lib/utils.js:52

Normalizes the initial indentation of the given content so that the first line is unindented, and all other lines are unindented to the same degree as the first line. So if the first line has four spaces at the beginning, then all lines will be unindented four spaces. Ported from Selleck

parameters:

  • content String
    Text to unindent.

returns:

type: String

Unindented text.

filterFileName
(
  • f
)
String

Provided by the utils module.

Defined in lib/utils.js:71

Normalizes a file path to a writable filename:

var path = 'lib/file.js'; returns 'lib_file.js';

parameters:

  • f String
    The filename to normalize

returns:

type: String

The filtered file path

getLayouts
(
  • dir
)
Object

Provided by the utils module.

Defined in lib/utils.js:86

Like getPages(), but returns only the files under the layout/ subdirectory of the specified dir.

parameters:

  • dir String
    Directory path.

returns:

type: Object

Mapping of layout names to layout content.

getPage
(
  • p
)
String | null

Provided by the utils module.

Defined in lib/utils.js:100

Loads and returns the content of the specified page file.

parameters:

  • p String
    Path to a single .handlebars page.

returns:

type: String | null

Page content, or null if not found.

getPages
(
  • dir
)
Object

Provided by the utils module.

Defined in lib/utils.js:117

Loads pages (files with a .handlebars extension) in the specified directory and returns an object containing a mapping of page names (the part of the filename) preceding the .handlebars extension) to page content.

parameters:

  • dir String
    Directory path.

returns:

type: Object

Mapping of page names to page content.

getPartials
(
  • dir
)
Object

Provided by the utils module.

Defined in lib/utils.js:160

Like getPages(), but returns only the files under the partial/ subdirectory of the specified dir.

parameters:

  • dir String
    Directory path.

returns:

type: Object

Mapping of partial names to partial content.

prepare
(
  • inDir
  • options
  • callback
)

Provided by the utils module.

Defined in lib/utils.js:174

Mix/merge/munge data into the template.

parameters:

  • inDir String
    The starting directory
  • options Object
    The options for the meta data.
  • callback callback
    The callback to excecute when complete
    • err Error
    • options Object
      Merged options.

fixType
(
  • t
)
String

Provided by the utils module.

Defined in lib/utils.js:253

Takes a type string and converts it to a "First letter upper cased" type. e.g. (string -> String, object -> Object)

parameters:

  • t String
    The type string to convert

returns:

type: String

The fixed string

webpath
(
  • url
)
String

Provided by the utils module.

Defined in lib/utils.js:276

Produces a normalized web path by joining all the parts and normalizing the filesystem-like path into web compatible url. Supports relative and absolute paths. Courtesy of Mojito's utils

parameters:

  • url Array | String
    the list of parts to be joined and normalized

returns:

type: String

The joined and normalized url

localize
(
  • str
  • lang
)
String

Provided by the utils module.

Defined in lib/utils.js:293

Localize the string via current Y.options

parameters:

  • str String
    the original string that you want to input
  • lang String
    the language

returns:

type: String

localized string from the param str

markdownLink
(
  • str
)
String

Provided by the utils module.

Defined in lib/utils.js:333

convert string to markdown link

parameters:

  • str String
    The original string that you want to input

returns:

type: String

marked string from the param str

buildFileTree
(
  • files
)
Object

Provided by the utils module.

Defined in lib/utils.js:348

build file tree object

parameters:

  • files Array

returns:

type: Object