Helpers

Helpers

Source:

Various helper methods

Members

(static, constant) exports.TagHelpers :Object

Reaction TagNav shared helpers

Source:
Type:
  • Object

(static) filterShippingStatus

get query for a given filter

Source:

(static) getPaymentForCurrentShop

get proper payment object as per current active shop

Source:

(static) getShippingInfo

get proper shipping object as per current active shop

Source:

Methods

(static) addAddress(address, validateAddressopt) → {Promise}

helper function that validates and adds an address in the account's addressBook via a meteor method.

Source:
Since:
  • 2.0.0
Parameters:
Name Type Attributes Description
address Object

address to be added.

validateAddress Boolean <optional>

Should validate first? Default is true

Returns:

Promise

Type
Promise

(static) convertLength(from, to, length) → {Number}

Convert length from/to different Units of Measure

Source:
Parameters:
Name Type Description
from String

The UOL to convert from

to String

The UOL to convert to

length Number

The value to convert

Returns:

The converted value

Type
Number

(static) convertWeight(from, to, weight) → {Number}

Convert weight from/to different Units of Measure

Source:
Parameters:
Name Type Description
from String

The UOM to convert from

to String

The UOM to convert to

weight Number

The value to convert

Returns:

The converted value

Type
Number

(static) filterWorkflowStatus(filter) → {Object}

get query for a given filter

Source:
Parameters:
Name Type Description
filter String

filter string to check against

Returns:

query for the workflow status

Type
Object

(static) getCardTypes(cardNumber) → {String}

Determine the card type and return label

Source:
To Do:
  • These should all be removed. PR's happily accepted.
  • needs i18n conversion?
Parameters:
Name Type Description
cardNumber String

a credit card number

Returns:

card label, ie: visa

Type
String

(static) getPrimaryMediaForItem(item) → {FileRecord|null}

Gets the FileRecord for the primary media item associated with the variant or product for the given item

Source:
Parameters:
Name Type Description
item Object

Must have productId and/or variantId set to get back a result.

Returns:
Type
FileRecord | null

(static) getPrimaryMediaForOrderItem(item) → {FileRecord|null}

Gets the FileRecord for the primary media item associated with the variant or product for the given item

Source:
Parameters:
Name Type Description
item Object

Must have productId and variantId set to get back a result.

Returns:
Type
FileRecord | null

(static) getSlug(slugString) → {String}

Return a slugified string using "slugify" from transliteration

Source:
See:
Parameters:
Name Type Description
slugString String

string to slugify

Returns:

slugified string

Type
String

(static) isObject(item) → {boolean}

Simple is object check.

Source:
Parameters:
Name Type Description
item Object

item to check if is an object

Returns:

return true if object

Type
boolean

(static) mergeDeep(target, source) → {Object}

Helper for Deep merge two objects.

Source:
Parameters:
Name Type Description
target Object

deep merge into this object

source Object

merge this object

Returns:

return deep merged object

Type
Object

(static) onError(errorMessage) → {undefined}

helper function that shows an error message in an alert toast.

Source:
Since:
  • 2.0.0
Parameters:
Name Type Description
errorMessage Object

error message object.

Returns:
Type
undefined

(static) removeAddress(_id) → {Promise}

helper function that updates an address in the account's addressBook via a meteor method.

Source:
Since:
  • 2.0.0
Parameters:
Name Type Description
_id String

_id of address to be removed.

Returns:

Promise

Type
Promise

(static) toCamelCase(needscamels) → {String}

helper for i18n - special toCamelCase for converting a string to camelCase for use with i18n keys

Source:
Parameters:
Name Type Description
needscamels String

String to be camel cased.

Returns:

camelCased string

Type
String

(static) toggleSession(sessionVariable, positiveState) → {Object}

Quick and easy snippet for toggling sessions

Source:
To Do:
  • These should all be removed. PR's happily accepted.
Parameters:
Name Type Description
sessionVariable String

string name, see http://docs.meteor.com/#/basic/session

positiveState String

optional, if is is positiveState, set opposite

Returns:

return session value

Type
Object

(static) translateRegistry(registry, appopt) → {Object}

adds i18n strings to registry object

Source:
Parameters:
Name Type Attributes Description
registry Object

registry object

app Object <optional>

complete package object

Returns:

with updated registry

Type
Object

(static) updateAddress(address, property, validateAddressopt) → {Promise}

helper function that validates and updates an address in the account's addressBook via a meteor method.

Source:
Since:
  • 2.0.0
Parameters:
Name Type Attributes Description
address Object

address to be updated.

property String

property to be updated.

validateAddress Boolean <optional>

Should validate first? Default is true

Returns:

Promise

Type
Promise