API Docs for: 0.8.0
Show:

DocumentCreator Class

This class is deprecated.

Creates structures for persistence and cleans various fields.

Methods

accessFormatting

(
  • post
)

Formats access levels

Parameters:

  • post Object

    Key value pair object

create

(
  • object_type
  • post
  • [csvItems]
  • [nullIfEmptyItems]
)
Object

Creates a document object ready to be injected into the database

Parameters:

  • object_type String

    The type of object to create

  • post Object

    Key value pair object to prepare

  • [csvItems] Array optional

    Keys whose values are to be split from CSVs into arrays

  • [nullIfEmptyItems] Array optional

    Keys whose values are to be null if empty

Returns:

Object:

The database ready document object

csvItemsToArrays

(
  • post
  • csvItems
)

Splits CSV items into arrays

Parameters:

  • post Object

    Key value pair object

  • csvItems Array

    Keys whose values should be arrays

emailFormatting

(
  • post
)

Formats email fields

Parameters:

  • post Object

    Key value pair object

emptyItemsToNull

(
  • post
  • nullIfEmptyItems
)

Formats empty items to null values

Parameters:

  • post Object

    Key value pair object

  • nullIfEmptyItems Array

    Keys whose values should be null if empty

formatIntegerItems

(
  • post
  • integerItems
)

Formats string items to integers

Parameters:

  • post Object

    Key value pair object

  • integerItems Array

    Keys whose values should be formatted as integers

passwordHash

(
  • post
)

Hashes all password fields

Parameters:

  • post Object

    Key value pair object

update

(
  • post
  • existingObject
  • [csvItems]
  • [nullIfEmptyItems]
)
Object

Updates a document object with new properties

Parameters:

  • post Object

    Key value pairs to update with

  • existingObject Object

    Object to update

  • [csvItems] Array optional

    Keys whose values are to be split from CSVs into arrays

  • [nullIfEmptyItems] Array optional

    Keys whose values are to be null if empty

Returns:

Object:

The database ready document object

usernameFormatting

(
  • post
)

Formats usernames

Parameters:

  • post Object

    Key value pair object