Skip to content
Kyle Amos edited this page Sep 23, 2015 · 5 revisions

Table of Contents generated with DocToc

Class: helpers

helpers

new helpers()

helpers for jsocrud

Source:

Methods

<static> convertFirstPathPart(path) → {ValidatedPath}

Convert the first path 'part' of a path into bracket notation

Parameters:
Name Type Description
path String

Path (e.g. foo[2].bar)

Source:
Returns:

ValidatedPath containing the correct path, firstPathPart and pathRemainder

Type
ValidatedPath

<static> formatFirstPathPart(pathPart) → {String}

Format a pathPart, returning it in bracket notation with previously unescaped double-quotes now escaped

Parameters:
Name Type Description
pathPart String

Component of a jsocrud path to format in bracket notation

Source:
Returns:

Formatted first path part (in bracket notation)

Type
String

<static> isEscaped(characterIndex, inputString) → {Boolean}

Look backwards from a position in a string to discern whether or not the character at the given position is escaped. Note: This does not look forward in the string from the given position, so be mindful of cases where that will bite you in the ass (e.g. "\\" character at index 1)

Parameters:
Name Type Description
characterIndex Number

Index of the character to check

inputString String

Entire string to check

Source:
Returns:

True if the character is escaped else False

Type
Boolean

<static> parsePath(validatedPath) → {Array}

Parse a validated path into components

Parameters:
Name Type Description
validatedPath ValidatedPath

Validated path data

Source:
Returns:

Path components

Type
Array

<static> validatePath(path) → {ValidatedPath}

Validates the given path and converts the first path part to bracket notation if necessary

Parameters:
Name Type Description
path String

Path in an object (e.g. ["foo"][2].bar)

Source:
Returns:

Validated path data

Type
ValidatedPath

Generated with wicked.