Skip to content

Latest commit

 

History

History
642 lines (308 loc) · 14.7 KB

internal.api.md

File metadata and controls

642 lines (308 loc) · 14.7 KB

Public and Private API

API documentation automatically generated by docmeteor.


File: "utility.js" Where: {client}


utility.cleanNulls(doc)  Client

This method is private This method cleanNulls is defined in Utility

Arguments

  • doc {Object}

Source object

Returns {Object}

Returns an object in which all properties with null, undefined, or empty string values have been removed, recursively.

cleanNulls: function cleanNulls(doc, isArray) { ... utility.js:11

utility.reportNulls(flatDoc)  Client

This method is private This method reportNulls is defined in Utility

Arguments

  • flatDoc {Object}

An object with no properties that are also objects.

Returns {Object} An object in which the keys represent the keys in the

original object that were null, undefined, or empty strings, and the value of each key is "".

reportNulls: function reportNulls(flatDoc) { ... utility.js:38

utility.docToModifier(doc)  Client

This method is private This method docToModifier is defined in Utility

Arguments

  • doc {Object}

An object to be converted into a MongoDB modifier

Returns {Object} A MongoDB modifier.

Converts an object into a modifier by flattening it, putting keys with null, undefined, and empty string values into modifier.$unset, and putting the rest of the keys into modifier.$set.

docToModifier: function docToModifier(doc) { ... utility.js:57

utility.getSelectValues(select)  Client

This method is private This method getSelectValues is defined in Utility

Arguments

DOM Element from which to get current values

Returns {string[]}

Gets a string array of all the selected values in a given select DOM element.

getSelectValues: function getSelectValues(select) { ... utility.js:84

utility.maybeNum(val)  Client

This method is private This method maybeNum is defined in Utility

Arguments

  • val {string}

Returns {String|Number}

If the given string can be converted to a number, returns the number. Otherwise returns the string.

maybeNum: function maybeNum(val) { ... utility.js:107

utility.lookup(obj)  Client

This method is private This method lookup is defined in Utility

Arguments

  • obj {Any}

Returns {Any}

If obj is a string, returns the value of the property with that name on the window object. Otherwise returns obj.

lookup: function lookup(obj) { ... utility.js:125

utility.getDefs(ss, name)  Client

This method is private This method getDefs is defined in Utility

Arguments

Returns {Object} Schema definitions object

Returns the schema definitions object from a SimpleSchema instance. Equivalent to calling ss.schema(name) but handles throwing errors if name is not a string or is not a valid field name for this SimpleSchema instance.

getDefs: function getDefs(ss, name) { ... utility.js:145

utility.objAffectsKey({Object}, {String})  Client

This method is private This method objAffectsKey is defined in Utility

Arguments

  • {Object} {any}

obj

  • {String} {any}

key

Returns {Boolean}

TODO

* should make this a static method in MongoObject

objAffectsKey: function objAffectsKey(obj, key) { ... utility.js:163

utility.expandObj({Object})  Client

This method is private This method expandObj is defined in Utility

Arguments

  • {Object} {any}

doc

Returns {Object}

Takes a flat object and returns an expanded version of it.

expandObj: function expandObj(doc) { ... utility.js:175

utility.compactArrays({Object})  Client

This method is private This method compactArrays is defined in Utility

Arguments

  • {Object} {any}

obj

Returns {undefined}

Edits the object by reference, compacting any arrays at any level recursively.

compactArrays: function compactArrays(obj) { ... utility.js:212

utility.getSimpleSchemaFromContext({Object})  Client

This method is private This method getSimpleSchemaFromContext is defined in Utility

Arguments

  • {Object} {any}

context

Returns {SimpleSchema}

Given a context object that may or may not have schema and collection properties, returns a SimpleSchema instance or throws an error if one cannot be obtained.

getSimpleSchemaFromContext: function getSimpleSchemaFromContext(context, formId) { ... utility.js:234

utility.isValidDateString({String})  Client

This method is private This method isValidDateString is defined in Utility

Arguments

  • {String} {any}

dateString

Returns {Boolean}

Returns true if dateString is a "valid date string"

isValidDateString: function isValidDateString(dateString) { ... utility.js:268

utility.isValidTimeString({String})  Client

This method is private This method isValidTimeString is defined in Utility

Arguments

  • {String} {any}

timeString

Returns {Boolean}

Returns true if timeString is a "valid time string"

isValidTimeString: function isValidTimeString(timeString) { ... utility.js:280

({Date})  Client

This method is private

Arguments

  • {Date} {any}

date

Returns {String}

Returns a "valid date string" representing the local date.

dateToDateString: function dateToDateString(date) { ... utility.js:297

({Date})  Client

This method is private

Arguments

  • {Date} {any}

date

Returns {String}

Returns a "valid date string" representing the date converted to the UTC time zone.

dateToDateStringUTC: function dateToDateStringUTC(date) { ... utility.js:316

({Date})  Client

This method is private

Arguments

  • {Date} {any}

date

Returns {String}

Returns a "valid normalized forced-UTC global date and time string" representing the time converted to the UTC time zone and expressed as the shortest possible string for the given time (e.g. omitting the seconds component entirely if the given time is zero seconds past the minute).

http: http:

dateToNormalizedForcedUtcGlobalDateAndTimeString: function dateToNormalizedForcedUtcGlobalDateAndTimeString(date) { ... utility.js:340

({String})  Client

This method is private

Arguments

  • {String} {any}

dateString

Returns {Boolean}

Returns true if dateString is a "valid normalized forced-UTC global date and time string"

isValidNormalizedForcedUtcGlobalDateAndTimeString: function isValidNormalizedForcedUtcGlobalDateAndTimeString(dateString) { ... utility.js:351

utility.dateToNormalizedLocalDateAndTimeString(date, offset)  Client

This method is private This method dateToNormalizedLocalDateAndTimeString is defined in Utility

Arguments

  • date {Date}
  • offset {String}

A valid offset string (to pass to moment.zone)

Returns {String}

Returns a "valid normalized local date and time string".

dateToNormalizedLocalDateAndTimeString: function dateToNormalizedLocalDateAndTimeString(date, offset) { ... utility.js:370

({String})  Client

This method is private

Arguments

  • {String} {any}

dtString

Returns {Boolean}

Returns true if dtString is a "valid normalized local date and time string"

isValidNormalizedLocalDateAndTimeString: function isValidNormalizedLocalDateAndTimeString(dtString) { ... utility.js:383

utility.normalizeContext({Object}, name)  Client

This method is private This method normalizeContext is defined in Utility

Arguments

  • {Object} {any}

context A context object, potentially with an atts or autoform property.

  • name {String}

The name of the helper or component we're calling from, for in a potential error message.

Returns {Object} Normalized context object

Returns an object with afc, af, and atts properties, normalized from whatever object is passed in. This helps deal with the fact that we have to pass the ancestor autoform's context to different helpers and components in different ways, but in all cases we want to get access to it and throw an error if we can't find an autoform context.

normalizeContext: function autoFormNormalizeContext(context, name) { ... utility.js:404


File: "form-preserve.js" Where: {client}


new FormPreserve(migrationName)  Client

This method is private

Arguments

  • migrationName {String}

Internal helper object to preserve form inputs across Hot Code Push and across "pages" navigation if the option is enabled.

FormPreserve = function formPreserveConstructor(migrationName) { ... form-preserve.js:9


File: "autoform.js" Where: {client}


autoform.addHooks(formIds, hooks)  Client

This method addHooks is defined in AutoForm

Arguments

Form id or array of form IDs to which these hooks apply. Specify null to add hooks that will run for every form.

  • hooks {Object}

Hooks to add, where supported names are "before", "after", "formToDoc", "docToForm", "onSubmit", "onSuccess", and "onError".

Returns {undefined}

Defines hooks to be used by one or more forms. Extends hooks lists if called multiple times for the same form.

AutoForm.addHooks = function autoFormAddHooks(formIds, hooks, replace) { ... autoform.js:20

autoform.hooks(hooks)  Client

This method hooks is defined in AutoForm

Arguments

  • hooks {Object}

Returns {undefined}

Defines hooks by form id. Extends hooks lists if called multiple times for the same form.

AutoForm.hooks = function autoFormHooks(hooks, replace) { ... autoform.js:56

autoform.resetForm(formId)  Client

This method resetForm is defined in AutoForm

Arguments

  • formId {String}

Returns {undefined}

Resets validation for an autoform.

AutoForm.resetForm = function autoFormResetForm(formId) { ... autoform.js:70

autoform.setDefaultTemplateForType(type, template)  Client

This method setDefaultTemplateForType is defined in AutoForm

Arguments

  • type {String}
  • template {String}

AutoForm.setDefaultTemplateForType = function autoFormSetDefaultTemplateForType(type, template) { ... autoform.js:138

autoform.getDefaultTemplateForType(type)  Client

This method getDefaultTemplateForType is defined in AutoForm

Arguments

  • type {String}

Returns {String} Template name

Reactive.

AutoForm.getDefaultTemplateForType = function autoFormGetDefaultTemplateForType(type) { ... autoform.js:157

autoform.getFormValues(formId)  Client

This method getFormValues is defined in AutoForm

Arguments

  • formId {String}

The id attribute of the autoForm you want current values for.

Returns {Object}

Returns an object representing the current values of all schema-based fields in the form. The returned object contains two properties, "insertDoc" and "updateDoc", which represent the field values as a normal object and as a MongoDB modifier, respectively.

AutoForm.getFormValues = function autoFormGetFormValues(formId) { ... autoform.js:175

autoform.getFieldValue(formId, fieldName)  Client

This method getFieldValue is defined in AutoForm

Arguments

  • formId {String}

The id attribute of the autoForm you want current values for.

  • fieldName {String}

The name of the field for which you want the current value.

Returns {Any}

Returns the value of the field (the value that would be used if the form were submitted right now). This is a reactive method that will rerun whenever the current value of the requested field changes.

AutoForm.getFieldValue = function autoFormGetFieldValue(formId, fieldName) { ... autoform.js:197

Returns schema keys that are direct children of the given schema key XXX this could be a method on ss