Global $n$-compact Validation Engine

Module

Utilities

Generic javascript utilities.

Methods

inner

checkExtension(name, extopt) → {string}

Checks a filename to see if it has the right extension and adds the extension if it doesn't. The default extension is 'js'.

Parameters

  • name string

    The filename to check.

  • ext string <optional>
    'js'

    The extension to add if missing.

Returns

  • string
    • The filename with the correct extension.

Source

inner

commonInitialSlice(…arrays) → {Array}

Find the longest common initial slice of a set of arrays.

Parameters

  • arrays Array <repeatable>

    The arrays to compare.

Returns

  • Array
    • The longest common initial slice of the arrays.

Source

inner

indent(s, n) → {string}

Indent string $s$ with a tab of $n$ spaces. If $s$ contains multiple lines, indent each line.

Parameters

  • s string

    the string to indent

  • n number

    the number of spaces to indent

Returns

  • string

    the resulting string

Source

inner

lineNum(n, widthopt, suffixopt) → {string}

Returns a right justified line number consisting of a minimum width padded on the right with a given suffix.

Parameters

  • n number

    The line number.

  • width number <optional>
    4

    The minimum width of the line number.

  • suffix string <optional>
    ': '

    The suffix to be added to the line number.

Returns

  • string

    The right justified line number.

Source

inner

subscript(n)

Convert the integer $n$ to a string consisting of the corresponding unicode subscript.

Parameters

  • n number

    The integer to be converted.

Source

inner

tab(n, charopt) → {string}

Return a string of $n$ spaces (or other character).

Parameters

  • n number

    the length of the string

  • char string <optional>
    ' '

    the character to use

Returns

  • string

    the resulting string

Source

inner

timer()

Report the time it took to execute function f, passed as an argument.

Source