Modules
- util/array
- util/blaze
- util/collection
- util/config
- util/data
- util/date
- util/emitter
- util/http
- util/image
- util/location
- util/meteor
- util/model
- util/number
- util/object
- util/popover
- util/reactivity
- util/schema
- util/config
- util/string
util/array
-
util/array
-
~move(array, fromIndex, toIndex) ⇒
Array.<any>
-
~addToSet(array, item) ⇒
Array.<any>
-
~addToSetInPlace(set, item) ⇒
boolean
-
~first(array) ⇒
any
-
~last(array) ⇒
any
- ~eachUntil(array, callback)
-
~remove(array, item) ⇒
Array.<any>
-
~removeAll(array, item) ⇒
Array.<any>
-
~forceArray(input) ⇒
Array.<any>
- ~mapAsync(array, callback, onComplete)
- ~forEachAsync(array, cb, onComplete)
-
~move(array, fromIndex, toIndex) ⇒
Array.<any>
util/array~move(array, fromIndex, toIndex) ⇒ Kind: inner method of util/array
Summary: moves an element at a given index to
another index
Export:
Param | Type | Description |
---|---|---|
array | Array.<any> |
an array containing the element to move |
fromIndex | number |
the location of the element to move |
toIndex | number |
the destination index |
Array.<any>
util/array~addToSet(array, item) ⇒ Kind: inner method of util/array
Summary: Returns an array containing item
, adding
it if it is missing.
Note: this only uses indexOf for comparison, so it
will not work for objects
Returns: Array.<any>
- the new array
Export:
Param | Type | Description |
---|---|---|
array | Array.<any> |
an array to potentially add item to |
item | any |
an item to ensure is within array
|
boolean
util/array~addToSetInPlace(set, item) ⇒ Kind: inner method of util/array
Summary: Adds item
to set
if it is
missing, returns true if set
was modified
Returns: boolean
- true if set
was modified
Export:
Param | Type | Description |
---|---|---|
set | Array.<any> |
a set to potentially add item to |
item | any |
an item to ensure is within set
|
any
util/array~first(array) ⇒ Kind: inner method of util/array
Summary: returns the first element in an array
Returns: any
- the first element of the array
Export:
Param | Type | Description |
---|---|---|
array | Array.<any> |
the array to search in |
any
util/array~last(array) ⇒ Kind: inner method of util/array
Summary: returns the last element in an array
Returns: any
- the last element of the array
Export:
Param | Type | Description |
---|---|---|
array | Array.<any> |
the array to search in |
util/array~eachUntil(array, callback)
Kind: inner method of util/array
Summary: calls callback
for each item in an array,
provided that the previous iteration didn't return false
Export:
Param | Type | Description |
---|---|---|
array | Array.<any> |
of items to iterate |
callback | ForEachCallback |
the function to invoke for each element in the supplied array |
Array.<any>
util/array~remove(array, item) ⇒ Kind: inner method of util/array
Summary: Remove an item from an array
Returns: Array.<any>
- The new array
Export:
Param | Type | Description |
---|---|---|
array | Array.<any> |
The array to remove item from |
item | any |
The item to remove. Cannot be an object |
Example
var array = ['a', 'b', 'c']
remove(array, 'b') // returns ['a', 'c']
Array.<any>
util/array~removeAll(array, item) ⇒ Kind: inner method of util/array
Summary: Removes all occurrences of item
from array
Returns: Array.<any>
- The new array
Export:
Param | Type | Description |
---|---|---|
array | Array.<any> |
The array to remove all occurrences of item from |
item | any |
The item to remove |
Example
var array = ['a', 'b', 'b', 'c']
removeAll(array, 'b') // returns ['a', 'c']
Array.<any>
util/array~forceArray(input) ⇒ Kind: inner method of util/array
Summary: wraps the input in an array if it isn't already one
Returns: Array.<any>
- always an array
Param | Type |
---|---|
input | any |
util/array~mapAsync(array, callback, onComplete)
Map an array's values, iterating asynchronously
Kind: inner method of util/array
Param | Description |
---|---|
array | The array to map |
callback | A callback to receive the current element & index. Should return the new value |
onComplete | A callback which will be called when all elements have been processed |
util/array~forEachAsync(array, cb, onComplete)
Iterate the elements in an array, calling the user-supplied callback on each element asynchronously
Kind: inner method of util/array
Param | Type | Description |
---|---|---|
array | Array.<any> |
The array to iterate |
cb | ArrayTypes.MapCallbackFunction |
the callback to receive the element(s) |
onComplete | ArrayTypes.CallbackFunction |
A callback to be called when all elements have been iterated |
util/blaze
util/blaze~attachAPI(blaze, API)
Attach a DDP connection to Blaze so that it is available in templates' this.subscribe
Kind: inner method of util/blaze
Param | Type | Description |
---|---|---|
blaze | Object |
a reference to Blaze |
API | Object |
The DDP connection to attachs |
util/blaze~onCountChanged(callback)
Add a function to get called when the count changes
Kind: inner method of util/blaze
Param | Type |
---|---|
callback | function |
util/collection
-
util/collection
-
~insert(collection, items) ⇒
ICollectionReturn
-
~update(collection, items) ⇒
ICollectionReturn
-
~remove(collection, _ids) ⇒
ICollectionReturn
-
~caseInsensitiveSelector(fieldName, str, [wordIsPrefix]) ⇒
Object
-
~selectorFromParams(selectorParams) ⇒
Object
-
~getObserverHandlers(context, collection) ⇒
IObserveHandlers
-
~mapHelpersToThis(pureHelpers) ⇒
any
-
~IFailedOps :
Object
-
~ICollectionReturn :
Object
-
~IObserveHandlers :
Object
-
~ISelectorParams :
Object
-
~insert(collection, items) ⇒
ICollectionReturn
util/collection~insert(collection, items) ⇒ Kind: inner method of util/collection
Summary: Inserts a number of items
into the given collection
Export:
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
A Mongo.Collection |
items | Array.<object> |
the items to insert. |
ICollectionReturn
util/collection~update(collection, items) ⇒ Kind: inner method of util/collection
Summary: Updates a number of items
into the given collection
Export:
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
A Mongo.Collection |
items | Array.<object> |
the items to update. The _id field is used as a selector, the rest of the object as the modifier |
ICollectionReturn
util/collection~remove(collection, _ids) ⇒ Kind: inner method of util/collection
Summary: Remvoves a number of items by their _id from the
given collection
Export:
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
A Mongo.Collection |
_ids | Array.<string> |
the _ids of the items to remove. |
Object
util/collection~caseInsensitiveSelector(fieldName, str, [wordIsPrefix]) ⇒ Kind: inner method of util/collection
Summary: Generates a selector for a field which will perform a case-insensitive
lookup for the given value
Returns: Object
- the Mongo selector object
Export:
Param | Type | Default | Description |
---|---|---|---|
fieldName | string |
the name of the field to query | |
str | string |
the value to query | |
[wordIsPrefix] | boolean |
false |
whether the supplied value for str is a prefix or the whole query |
Object
util/collection~selectorFromParams(selectorParams) ⇒ Kind: inner method of util/collection
Summary: Parses "skip", "limit", "sort", "before" and "since" into a selector and options object
Returns: Object
- The constructed selector & options objects
Export:
Param | Type | Description |
---|---|---|
selectorParams | ISelectorParams |
An object containing any/all of the defined keys. "createdOrUpdated" can be either "createdAt" (default) or "updatedAt". It determines what "before" and "since" act upon |
IObserveHandlers
util/collection~getObserverHandlers(context, collection) ⇒ Kind: inner method of util/collection
Summary: Returns a map of default observe callback handlers
Returns: IObserveHandlers
- The map of callback handlers
Export:
Param | Type | Description |
---|---|---|
context | any |
The this context. It should contain added , changed and removed methods |
collection | string |
The name of the collection to add/change/remove documents to/from |
any
util/collection~mapHelpersToThis(pureHelpers) ⇒ Takes an object of helpers and wraps them in functions that use
the this
context and pass it as the first arg. Allows this
less functions
to be used as collection helpers
Kind: inner method of util/collection
Param | Type | Description |
---|---|---|
pureHelpers | any |
helpers to map |
Object
util/collection~IFailedOps : Kind: inner typedef of util/collection
Properties
Name | Type | Description |
---|---|---|
code | number |
the error code |
message | string |
the error message |
additional | any |
meta information about the error |
Object
util/collection~ICollectionReturn : Kind: inner typedef of util/collection
Properties
Name | Type | Description |
---|---|---|
success | boolean |
Whether no operations failed |
failed | Array.<IFailedOps> |
an array of objects detailling failed operations |
succeeded | Array.<(any|boolean)> |
an array of objects detailling documents of successful operations |
Object
util/collection~IObserveHandlers : Kind: inner typedef of util/collection
Properties
Name | Type |
---|---|
added | function |
changed | function |
removed | function |
Object
util/collection~ISelectorParams : Kind: inner typedef of util/collection
Properties
Name | Type | Default | Description |
---|---|---|---|
[skip] | number |
A number indicating how many matching documents to skip | |
[limit] | number |
A number indicating the maximum number of documents to return | |
[sort] | Object.<number> |
An object whose keys equate to database column names and whose values are either 1 or -1 to indicate sort order | |
[createdOrUpdated] | string |
""createdAt"" |
|
[before] |
Date | string | number
|
A parsable representation of a date. Only documents whose createdAt or updatedAt (as defined by createdOrUpdated) are greater than the supplied value will be returned | |
[since] |
Date | string | number
|
A parsable representation of a date. Only documents whose createdAt or updatedAt (as defined by createdOrUpdated) are less than the supplied value will be returned | |
[fields] | Object.<number> |
An object whose keys equate to database column names and whose values are either 1 or 0 to indicate inclusion or exclusion |
util/config
util/config~Configuration
Kind: inner class of util/config
new Configuration(collection, Meteor, [Tracker], [connection])
A configuration class - provides a DB-backed, environment variable / meteor.settings populated set of config values
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
the config collection |
Meteor | Object |
a reference to the Meteor object |
[Tracker] | Object |
an optional reference to Tracker - will be mocked in a non-reactive way if not supplied |
[connection] | Object |
an optional override for the DDP connection to use to subscribe to the config pub |
util/config~StandaloneConfiguration
Kind: inner class of util/config
new StandaloneConfiguration()
A configuration class - provides an environment variable / codebase-populated set of config values
util/data
-
util/data
-
~titles([flatten]) ⇒
Array.<object>
|Array.<string>
-
~genders([flatten]) ⇒
Array.<object>
|Array.<string>
-
~maritalStatuses([flatten]) ⇒
Array.<object>
|Array.<string>
-
~nationalities([flatten]) ⇒
Array.<object>
|Array.<string>
-
~titles([flatten]) ⇒
Array.<object>
| Array.<string>
util/data~titles([flatten]) ⇒ Kind: inner method of util/data
Summary: provides a list of name titles
Returns: Array.<object>
| Array.<string>
- If flatten is true, an array of string values otherwise an array of objects with name
and camelized value
Export:
Param | Type | Default | Description |
---|---|---|---|
[flatten] | boolean |
false |
whether to return an array of plain text values |
Array.<object>
| Array.<string>
util/data~genders([flatten]) ⇒ Kind: inner method of util/data
Summary: provides a list of genders
Returns: Array.<object>
| Array.<string>
- If flatten is true, an array of string values otherwise an array of objects with name
and camelized value
Export:
Param | Type | Default | Description |
---|---|---|---|
[flatten] | boolean |
false |
whether to return an array of plain text values |
Array.<object>
| Array.<string>
util/data~maritalStatuses([flatten]) ⇒ Kind: inner method of util/data
Summary: provides a list of maritalStatuses
Returns: Array.<object>
| Array.<string>
- If flatten is true, an array of string values otherwise an array of objects with name
and camelized value
Export:
Param | Type | Default | Description |
---|---|---|---|
[flatten] | boolean |
false |
whether to return an array of plain text values |
Array.<object>
| Array.<string>
util/data~nationalities([flatten]) ⇒ Kind: inner method of util/data
Summary: provides a list of nationalities
Returns: Array.<object>
| Array.<string>
- If flatten is true, an array of string values otherwise an array of objects with name
and camelized value
Export:
Param | Type | Default | Description |
---|---|---|---|
[flatten] | boolean |
false |
whether to return an array of plain text values |
util/date
-
util/date
-
~randomBetween(from, to) ⇒
Date
-
~getDate([startEnd], [prevNext], [interval]) ⇒
Date
-
~yesterday([startEnd]) ⇒
Date
-
~tomorrow([startEnd]) ⇒
Date
-
~lastWeek([startEnd]) ⇒
Date
-
~nextWeek([startEnd]) ⇒
Date
-
~lastMonth([startEnd]) ⇒
Date
-
~nextMonth([startEnd]) ⇒
Date
-
~getPreviousDay(day) ⇒
string
-
~getNextDay(day) ⇒
string
-
~randomBetween(from, to) ⇒
Date
util/date~randomBetween(from, to) ⇒ Kind: inner method of util/date
Summary: gets a random date between two others
Returns: Date
- the random date
Export:
Param | Type | Description |
---|---|---|
from | Date |
random date must be greater than this |
to | Date |
random date must be less than this |
Date
util/date~getDate([startEnd], [prevNext], [interval]) ⇒ Gets a Date object of a given offset from now
Kind: inner method of util/date
Returns: Date
- the date object
Param | Type | Default | Description |
---|---|---|---|
[startEnd] | string |
Either 'start' or 'end' to round the date to the start or end of the day | |
[prevNext] | string |
"'prev'" |
|
[interval] | string |
"'day'" |
Date
util/date~yesterday([startEnd]) ⇒ Return a Date object from 24 hours ago
Kind: inner method of util/date
Returns: Date
- the date object
Param | Type | Description |
---|---|---|
[startEnd] | string |
either 'start' or 'end' - determines whether to round the date to the start or end of the day |
Date
util/date~tomorrow([startEnd]) ⇒ Return a Date object for 24 hours in the future
Kind: inner method of util/date
Returns: Date
- the date object
Param | Type | Description |
---|---|---|
[startEnd] | string |
either 'start' or 'end' - determines whether to round the date to the start or end of the day |
Date
util/date~lastWeek([startEnd]) ⇒ Return a Date object from 7 days ago
Kind: inner method of util/date
Returns: Date
- the date object
Param | Type | Description |
---|---|---|
[startEnd] | string |
either 'start' or 'end' - determines whether to round the date to the start or end of the day |
Date
util/date~nextWeek([startEnd]) ⇒ Return a Date object for 7 days in the future
Kind: inner method of util/date
Returns: Date
- the date object
Param | Type | Description |
---|---|---|
[startEnd] | string |
either 'start' or 'end' - determines whether to round the date to the start or end of the day |
Date
util/date~lastMonth([startEnd]) ⇒ Return a Date object from 30 days ago
Kind: inner method of util/date
Returns: Date
- the date object
Param | Type | Description |
---|---|---|
[startEnd] | string |
either 'start' or 'end' - determines whether to round the date to the start or end of the day |
Date
util/date~nextMonth([startEnd]) ⇒ Return a Date object for 30 days in the future
Kind: inner method of util/date
Returns: Date
- the date object
Param | Type | Description |
---|---|---|
[startEnd] | string |
either 'start' or 'end' - determines whether to round the date to the start or end of the day |
string
util/date~getPreviousDay(day) ⇒ Can be passed either a full or three-letter day name and will return the previous day's name
Kind: inner method of util/date
Returns: string
- the name of the previous day
Param | Type | Description |
---|---|---|
day | string |
a full or three-letter day name |
string
util/date~getNextDay(day) ⇒ Can be passed either a full or three-letter day name and will return the next day's name
Kind: inner method of util/date
Returns: string
- the name of the next day
Param | Type | Description |
---|---|---|
day | string |
a full or three-letter day name |
util/emitter
util/emitter.MultiEmitter
Kind: static class of util/emitter
Export:
new MultiEmitter()
Slightly more advanced event emitter style class that allows listening to different events via string arguments
util/emitter.Emitter
Kind: static class of util/emitter
Export:
new Emitter()
Basic class that represents an event that can be listened to and broadcasted
util/emitter.MultiEmitter#listen(event, callback)
Add a callback to be ran whenver this event is broadcasted
Kind: static method of util/emitter
Param | Description |
---|---|
event | the event as a string to be listened to |
callback | the callback to run whenever said event is triggered |
util/emitter.MultiEmitter#broadcast(event, value)
Broadcast an event of the given type
Kind: static method of util/emitter
Param | Description |
---|---|
event | even type to broadcast |
value | value to be passed to each callback |
util/emitter.MultiEmitter#removeListeners(event)
Remove all attached listeners for a specific event type
Kind: static method of util/emitter
Param |
---|
event |
util/emitter.Emitter#listen()
Add a callback to be ran whenver this event is broadcasted
Kind: static method of util/emitter
util/emitter.Emitter#broadcast(value)
Calls all callbacks that have been registered with the given value
Kind: static method of util/emitter
Param | Description |
---|---|
value | value to broadcast, if any |
util/emitter.Emitter#removeListeners()
Remove all attached listeners
Kind: static method of util/emitter
util/http
-
util/http
-
~getBaseParameter([{ location, type, required }]) ⇒
Object
-
~requiredBodyString(extendedDef) ⇒
Object
-
~requiredBodyNumber(extendedDef) ⇒
Object
-
~requiredBodyDate(extendedDef) ⇒
Object
-
~requiredBodyBoolean(extendedDef) ⇒
Object
-
~requiredBodyObject(extendedDef) ⇒
Object
-
~optionalBodyString(extendedDef) ⇒
Object
-
~optionalBodyNumber(extendedDef) ⇒
Object
-
~optionalBodyDate(extendedDef) ⇒
Object
-
~optionalBodyBoolean(extendedDef) ⇒
Object
-
~optionalBodyObject(extendedDef) ⇒
Object
-
~getBaseParameter([{ location, type, required }]) ⇒
Object
util/http~getBaseParameter([{ location, type, required }]) ⇒ Kind: inner method of util/http
Summary: returns a basic Swagger parameter field
Export:
Param | Type | Default |
---|---|---|
[{ location, type, required }] | * |
{} |
Object
util/http~requiredBodyString(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a required body string parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~requiredBodyNumber(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a required body number parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~requiredBodyDate(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a required body string parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~requiredBodyBoolean(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a required body boolean parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~requiredBodyObject(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a required body object parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~optionalBodyString(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a optional body string parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~optionalBodyNumber(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a optional body number parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~optionalBodyDate(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a optional body string parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~optionalBodyBoolean(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a optional body boolean parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
Object
util/http~optionalBodyObject(extendedDef) ⇒ Kind: inner method of util/http
Summary: scaffolds a optional body object parameter
Export:
Param | Type | Description |
---|---|---|
extendedDef | Object |
the rest of the definition |
util/image
blob
util/image~dataURIToBlob(dataURI) ⇒ Kind: inner method of util/image
Summary: converts a data uri to a blob://
Returns: blob
- the uri as a blob
Export:
Param | Type | Description |
---|---|---|
dataURI | string |
the data uri to convert into a blob |
util/image~toDataURI(file, callback)
Kind: inner method of util/image
Summary: converts an image file to a data uri
Export:
Param | Type | Description |
---|---|---|
file | File |
the image file to convert |
callback | function |
a function to receive the result of the conversion |
util/location
number
util/location~calculateDistance(lat1, lon1, lat2, lon2) ⇒ Kind: inner method of util/location
Summary: Get the distance in KM between two latitude/longitude pairs
Returns: number
- The distance between the two points, in KM
Export:
Param | Type | Description |
---|---|---|
lat1 | number |
The first latitude |
lon1 | number |
The first longitude |
lat2 | number |
The second latitude |
lon2 | number |
The second longitude |
util/meteor
util/meteor~assert(assertion, errorCode, [meta])
Kind: inner method of util/meteor
Summary: if the assertion is falsey, throws
an error
Export:
Param | Type | Description |
---|---|---|
assertion | any |
anything that should be truthy to not throw an error |
errorCode | number |
the error code |
[meta] | any |
additional info to include with the error |
util/meteor~assertString(value, name)
Assert that the typeof ${value} is 'string'
Kind: inner method of util/meteor
Param | Description |
---|---|
value | any value to check the type of |
name | the name of the value being checked |
util/meteor~assertBoolean(value, name)
Assert that the typeof ${value} is 'boolean'
Kind: inner method of util/meteor
Param | Description |
---|---|
value | any value to check the type of |
name | the name of the value being checked |
util/meteor~assertNumber(value, name)
Assert that the typeof ${value} is 'number'
Kind: inner method of util/meteor
Param | Description |
---|---|
value | any value to check the type of |
name | the name of the value being checked |
util/meteor~assertInt(value, name)
Assert that the ${value} is an integer
Kind: inner method of util/meteor
Param | Description |
---|---|
value | any value to check the type of |
name | the name of the value being checked |
util/meteor~assertObject(value, name)
Assert that the typeof ${value} is 'object'
Kind: inner method of util/meteor
Param | Description |
---|---|
value | any value to check the type of |
name | the name of the value being checked |
util/meteor~assertArray(value, name, type)
Assert that the ${value} is an array
Kind: inner method of util/meteor
Param | Description |
---|---|
value | any value to check the type of |
name | the name of the value being checked |
type | the expected datatype of every item within the supposed array |
util/meteor~assertDate(value, options)
Assert that the typeof ${value} is 'Date'
Kind: inner method of util/meteor
Param | Description |
---|---|
value | any value to check the type of |
options | whether to parse the date |
util/model
-
util/model
-
~ModelDefinition
- new ModelDefinition(t)
-
.ModelDefinition#auto(func) ⇒
this
-
.ModelDefinition#maybe() ⇒
this
-
.ModelDefinition#max(val, [exclusive]) ⇒
this
-
.ModelDefinition#min(val, [exclusive]) ⇒
this
-
.ModelDefinition#maxCount(val) ⇒
this
-
.ModelDefinition#minCount(val) ⇒
this
-
.ModelDefinition#subtype(format) ⇒
this
-
.ModelDefinition#prop(name, value) ⇒
this
-
.ModelDefinition#props(properties) ⇒
this
-
.ModelDefinition#elems(definition) ⇒
this
-
.ModelDefinition#regex(pattern) ⇒
this
-
.ModelDefinition#in(values) ⇒
this
-
.ModelDefinition#join(model, [field], where) ⇒
this
-
.ModelDefinition#other(key, value) ⇒
this
-
~def ⇒
this
-
~ILinkWhere :
Object
-
~ILink :
Object
-
~ModelDefinition
util/model~ModelDefinition
Kind: inner class of util/model
Export:
-
~ModelDefinition
- new ModelDefinition(t)
-
.ModelDefinition#auto(func) ⇒
this
-
.ModelDefinition#maybe() ⇒
this
-
.ModelDefinition#max(val, [exclusive]) ⇒
this
-
.ModelDefinition#min(val, [exclusive]) ⇒
this
-
.ModelDefinition#maxCount(val) ⇒
this
-
.ModelDefinition#minCount(val) ⇒
this
-
.ModelDefinition#subtype(format) ⇒
this
-
.ModelDefinition#prop(name, value) ⇒
this
-
.ModelDefinition#props(properties) ⇒
this
-
.ModelDefinition#elems(definition) ⇒
this
-
.ModelDefinition#regex(pattern) ⇒
this
-
.ModelDefinition#in(values) ⇒
this
-
.ModelDefinition#join(model, [field], where) ⇒
this
-
.ModelDefinition#other(key, value) ⇒
this
new ModelDefinition(t)
Class to generate model definitions
Param | Type | Description |
---|---|---|
t | string |
The type for this definition |
this
ModelDefinition.ModelDefinition#auto(func) ⇒ Define an autoValue
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
func | function |
The autovalue function |
this
ModelDefinition.ModelDefinition#maybe() ⇒ Set this field as optional
Kind: static method of ModelDefinition
this
ModelDefinition.ModelDefinition#max(val, [exclusive]) ⇒ Set this field's maximum allowed value / length
Kind: static method of ModelDefinition
Param | Type | Default | Description |
---|---|---|---|
val | number |
The max value / length | |
[exclusive] | boolean |
false |
Whether this value is an exclusive max |
this
ModelDefinition.ModelDefinition#min(val, [exclusive]) ⇒ Set this field's minimum allowed value / length
Kind: static method of ModelDefinition
Param | Type | Default | Description |
---|---|---|---|
val | number |
The min value / length | |
[exclusive] | boolean |
false |
Whether this value is an exclusive min |
this
ModelDefinition.ModelDefinition#maxCount(val) ⇒ Set the maximum number of allowed elements in an array field
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
val | number |
The max number of elements |
this
ModelDefinition.ModelDefinition#minCount(val) ⇒ Set the minimum number of allowed elements in an array field
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
val | number |
The min number of elements |
this
ModelDefinition.ModelDefinition#subtype(format) ⇒ Set the subtype / format of this field. E.g. "float" for a number type
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
format | string |
The format / subtype |
this
ModelDefinition.ModelDefinition#prop(name, value) ⇒ Define a single property of an object-type field
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
name | string |
The property name |
value | ModelDefinition |
The property value |
this
ModelDefinition.ModelDefinition#props(properties) ⇒ Define all properties of an object-type field
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
properties | * |
The property definitions |
this
ModelDefinition.ModelDefinition#elems(definition) ⇒ Define the elements of an array-type field
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
definition | ModelDefinition |
The definition which applies to all elements |
this
ModelDefinition.ModelDefinition#regex(pattern) ⇒ Define a RegEx pattern which applies to a string-type field
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
pattern | RegEx |
The pattern |
this
ModelDefinition.ModelDefinition#in(values) ⇒ Define a list of permitted values for this field
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
values |
Array | ILink
|
The array of allowed values |
this
ModelDefinition.ModelDefinition#join(model, [field], where) ⇒ Define a link to another Model
Kind: static method of ModelDefinition
Param | Type | Default | Description |
---|---|---|---|
model | string |
The name of the model | |
[field] | string |
"'_id'" |
The field on the other model to join on |
where | * |
An optional selector for items in the foreign model |
this
ModelDefinition.ModelDefinition#other(key, value) ⇒ Set a custom definition key
Kind: static method of ModelDefinition
Param | Type | Description |
---|---|---|
key | string |
The key name |
value | * |
The value |
this
util/model~def ⇒ Shorthand to get an instance of ModelDefinition
Kind: inner constant of util/model
Param | Type | Description |
---|---|---|
type | string |
The type of the field (e.g. 'string' / 'boolean') |
Object
util/model~ILinkWhere : Kind: inner typedef of util/model
Properties
Name | Type |
---|---|
* | * |
Object
util/model~ILink : Kind: inner typedef of util/model
Properties
Name | Type |
---|---|
model | string |
[field] | string |
[where] | ILinkWhere |
util/number
-
util/number
-
~clamp(val, min, max) ⇒
number
- ~random([min], [max])
-
~pad(num, width, char) ⇒
string
-
~clamp(val, min, max) ⇒
number
util/number~clamp(val, min, max) ⇒ Kind: inner method of util/number
Summary: ensures that a number falls between two
others, constraining it if necessary
Returns: number
- the clamped number
Export:
Param | Type | Description |
---|---|---|
val | number |
the number to clamp |
min | number |
the minimum that the number should be |
max | number |
the maximum that the number should be |
util/number~random([min], [max])
Kind: inner method of util/number
Summary: Returns a random integer, optionally between an min and max
Export:
Param | Type | Description |
---|---|---|
[min] | number |
The minimum acceptable value |
[max] | number |
The maximum acceptable value |
string
util/number~pad(num, width, char) ⇒ Kind: inner method of util/number
Summary: pads out a number to specified width with specified char or 0
Returns: string
- the padded number
Export:
Param |
---|
num |
width |
char |
util/object
-
util/object
-
~map(object, callback) ⇒
any
- ~transform(object, callback)
- ~forEach()
-
~filter(object, callback) ⇒
any
-
~resolve() ⇒
any
|undefined
-
~didResolve() ⇒
boolean
-
~resolveIf() ⇒
any
|null
-
~resolveSet() ⇒
boolean
- ~transformPathsToObjects(obj) ⇒
- ~flatten(input, _output, _prefix)
- ~flattenAll(input, _output, _prefix)
-
~resolveSetP(outerObj, outerPath, outerVal) ⇒
boolean
- ~mapAsync
- ~transformAsync
-
~map(object, callback) ⇒
any
util/object~map(object, callback) ⇒ Kind: inner method of util/object
Summary: passes each key=>value pair to callback
,
setting the result to a new object under a key of
the same name
Returns: any
- a new object with the same key names but mapped values
Export:
Param | Type | Description |
---|---|---|
object | any |
the object whose values to map |
callback | function |
a function to pass each key=>value pair to |
util/object~transform(object, callback)
Kind: inner method of util/object
Summary: Like map, but able to transform the key too. Map the object into a completely
different
Param | Description |
---|---|
object | the object to transform |
callback | callback to perform the transformation, return an array like [key, value] |
util/object~forEach()
Kind: inner method of util/object
Summary: Like array.forEach, but for an object, gets keys and values
any
util/object~filter(object, callback) ⇒ Kind: inner method of util/object
Summary: passes each key=>value pair of an object
to callback
, copying them over if the result is
truthy
Returns: any
- a filtered copy of the input object
Export:
Param | Type | Description |
---|---|---|
object | any |
the object whose keys to filter |
callback | function |
the function to pass each key=>value pair to |
any
| undefined
util/object~resolve() ⇒ Kind: inner method of util/object
Summary: get a nested property of an object by string e.g. resolve(myObj, 'nested.property')
Returns: any
| undefined
- resolved value or undefined if intermediate values are undefined
Export:
boolean
util/object~didResolve() ⇒ Kind: inner method of util/object
Summary: report whether an attempt to resolve a nested property of an object
was successful or not.
Returns: boolean
- whether the nested property exists
Export:
any
| null
util/object~resolveIf() ⇒ Kind: inner method of util/object
Summary: same as resolve but sets the property to val
Returns: any
| null
- The resolved value or null
Export:
boolean
util/object~resolveSet() ⇒ Kind: inner method of util/object
Summary: same as resolve but sets the property to val
Returns: boolean
- whether setting was successful
Export:
util/object~transformPathsToObjects(obj) ⇒
Transform an entire object by converting all of its keys into object paths using resolveSet
Kind: inner method of util/object
Returns: obj for convenience, although transformed in place
Param | Description |
---|---|
obj | the object to transform (transformed in place) |
util/object~flatten(input, _output, _prefix)
Convert a deep object into one which is flat (has a max depth of 1 level). The output object's keys will use dot notation to symbolise depth. If a property contains a dot, this will be converted to "[dot]"
Kind: inner method of util/object
Param | Type | Description |
---|---|---|
input | object |
An input object. Required |
_output | object |
Private param used in recursion |
_prefix | string |
Private param used in recursion |
Example
var deepObj = {person: {profile: {name: 'Carl', age: 26}, password: 'foobar', '.withDot': true}}
var res = flatten(deepObj)
// res === {
// 'person.profile.name': 'Carl',
// 'person.profile.age': 26,
// 'person.password': 'foobar',
// 'person.[dot]withDot': true
// }
util/object~flattenAll(input, _output, _prefix)
Convert a deep object into one which is flat (has a max depth of 1 level). The output object's keys will use dot notation to symbolise depth. Also processes arrays
Kind: inner method of util/object
Param | Type | Description |
---|---|---|
input | object |
An input object. Required |
_output | object |
Private param used in recursion |
_prefix | string |
Private param used in recursion |
Example
var deepObj = {person: {profile: {name: 'Carl', age: 26}, things: ['foo', 'bar'], '.withdot': true}}
flattenAll(deepObj)
// returns {
// 'person.profile.name': 'Carl',
// 'person.profile.age': 26,
// 'person.things.0': 'foo',
// 'person.things.1': 'bar'
// 'person.[dot]withDot: true
// }
boolean
util/object~resolveSetP(outerObj, outerPath, outerVal) ⇒ Kind: inner method of util/object
Summary: same as resolveSet, but will create paths down into
objects where they don't exist
Returns: boolean
- whether the op was successful
Export:
Param | Type | Description |
---|---|---|
outerObj | object |
the object to create the value in |
outerPath | string |
the path (dot notation) into the object |
outerVal | any |
the new value |
util/object~mapAsync
Kind: inner typedef of util/object
Summary: passes each key=>value pair to callback
asynchronously, setting the result to a new object under a key of
the same name. Calls onComplete when all keys have been mapped
Export:
Param | Type | Description |
---|---|---|
object | any |
the object whose values to map |
callback | function |
a function to pass each key=>value pair to |
onComplete | function |
a callback which will receive two arguments, error and res |
util/object~transformAsync
Kind: inner typedef of util/object
Summary: Like map, but able to transform the key too. Map the object into a completely different shape. Iterates
asynchronously
Export:
Param | Type | Description |
---|---|---|
object | any |
the object to transform |
cb | function |
callback to perform the transformation, return an array like [key, value] |
onComplete | function |
a callback which will received two arguments, error and res |
util/popover
util/popover~open(source, content, options)
Opens a popover with the specified content located on the edge of the source object
Kind: inner method of util/popover
Param | Description |
---|---|
source | the target element this popover should be attached to |
content | the content to show in the popover |
options |
util/popover~openDropdown(source, dropDownItems, options)
Opens a dropdown, which internally is still a popover with some special additions
Kind: inner method of util/popover
Param | Description |
---|---|
source | which element should the dropdown be attached to? |
dropDownItems | the items that should be shown in the dropdown @see DropDownItem |
options |
util/popover~ifLet(toCheck, ifCallback, elseCallback)
Internal function used to run a specific callback with a value if it exists
Kind: inner method of util/popover
Param | Description |
---|---|
toCheck | the value, or values to check |
ifCallback | the callback to run with the value if it exists |
elseCallback | the callback to run if the value does not exist |
util/popover~viewportPosition(element)
Internal function used to get the viewport position of an element
Kind: inner method of util/popover
Param |
---|
element |
util/popover~addTriangleToFixedElement(element, positionedWhere, pointingAt, container) ⇒
Adds a triangle to point at the edge of one element (element) to a target (pointingAt)
Kind: inner method of util/popover
Returns: the triangle element
Param | Description |
---|---|
element | the element doing the pointing |
positionedWhere | where is the popup in relation to the target |
pointingAt | what should it point at |
container | where do we add the triangle |
util/popover~positionFixed(element, relativeTo)
Position an element relative to another
Kind: inner method of util/popover
Param | Description |
---|---|
element | the element to position |
relativeTo | the element to use as an anchor |
util/reactivity
any
util/reactivity~reactivelyStore(getter, autorunnerOrTemplate) ⇒ Store some data that depends on reactive data sources in a reactive var so as not to recalculate it every time
Kind: inner method of util/reactivity
Returns: any
- a function that when called returns the latest value of the data
Param | Description |
---|---|
getter | callback to get the value |
autorunnerOrTemplate |
util/schema
-
util/schema
-
~optional(primitive) ⇒
Object
-
~blackbox(primitive) ⇒
IBlackbox
-
~optionalBlackbox(primitive) ⇒
IOptionalBlackbox
-
~createdDate() ⇒
Schema.ICreatedDate
-
~updatedDate() ⇒
Schema.IUpdatedDate
-
~geoJSON(SimpleSchema) ⇒
Schema.IGeoJSON
- ~defaultValue(type, value)
- ~optionalDefaultValue(type, value)
-
~minZeroNumber() ⇒
Object
-
~optionalMinZeroNumber() ⇒
Object
-
~minZeroNumberWithDefault() ⇒
Object
- ~integerBetweenValues(min, max)
- ~optionalIntegerBetweenValues(min, max)
-
~idParams(name) ⇒
any
-
~checkParameters(context, params, schema) ⇒
boolean
-
~positiveNumber() ⇒
Object
-
~optionalPositiveNumber() ⇒
Object
-
~positiveInteger() ⇒
Object
-
~optionalPositiveInteger() ⇒
Object
-
~immutable() ⇒
Object
-
~optionalImmutable() ⇒
Object
- ~alwaysArray()
-
~optional(primitive) ⇒
Object
util/schema~optional(primitive) ⇒ Kind: inner method of util/schema
Summary: returns an optional primitive definition
Returns: Object
- the schema value definition
Export:
Param | Type |
---|---|
primitive |
Schema.PrimitiveConstructor | string
|
IBlackbox
util/schema~blackbox(primitive) ⇒ Kind: inner method of util/schema
Summary: returns an blackbox primitive definition
Returns: IBlackbox
- the schema value definition
Export:
Param | Type | Description |
---|---|---|
primitive |
Schema.PrimitiveConstructor | string
|
(technically this will always be Object but it is configurable for consistency) |
IOptionalBlackbox
util/schema~optionalBlackbox(primitive) ⇒ Kind: inner method of util/schema
Summary: returns an optional, blackboxed primitive definition
Returns: IOptionalBlackbox
- the schema value definition
Export:
Param | Type | Description |
---|---|---|
primitive |
Schema.PrimitiveConstructor | string
|
(technically this will always be Object but it is configurable for consistency) |
Schema.ICreatedDate
util/schema~createdDate() ⇒ Kind: inner method of util/schema
Summary: returns a typedef with a type of Date and an
autoValue function which returns a new date on insert
Returns: Schema.ICreatedDate
- the schema value definition
Export:
Schema.IUpdatedDate
util/schema~updatedDate() ⇒ Kind: inner method of util/schema
Summary: returns a typedef with a type of Date and an
autoValue function which returns a new date
Returns: Schema.IUpdatedDate
- the schema value definition
Export:
Schema.IGeoJSON
util/schema~geoJSON(SimpleSchema) ⇒ Kind: inner method of util/schema
Summary: returns a typedef for a geoJSON object
Returns: Schema.IGeoJSON
- the schema value definition
Export:
Param | Type | Description |
---|---|---|
SimpleSchema | * |
A reference to SimpleSchema |
util/schema~defaultValue(type, value)
Kind: inner method of util/schema
Summary: returns a typedef for a field with a defined default
Export:
Param | Type | Description |
---|---|---|
type |
Schema.PrimitiveConstructor | string
|
The type constructor (e.g. Number) |
value | any |
The default value |
util/schema~optionalDefaultValue(type, value)
Kind: inner method of util/schema
Summary: returns a typedef for an optional field with a defined default
Export:
Param | Type | Description |
---|---|---|
type |
Schema.PrimitiveConstructor | string
|
The type constructor (e.g. Number) |
value | any |
The default value |
Object
util/schema~minZeroNumber() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for a field for a number with a minimum
permitted value of zero
Returns: Object
- typedef for number field with min value of 0
Export:
Object
util/schema~optionalMinZeroNumber() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for an optional field for a number with a minimum
permitted value of zero
Returns: Object
- typedef for optional number field with min value of 0
Export:
Object
util/schema~minZeroNumberWithDefault() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for a field for a number with a minimum
permitted and default value of zero
Returns: Object
- typedef for number field with minimum and default value of 0
Export:
util/schema~integerBetweenValues(min, max)
Kind: inner method of util/schema
Summary: returns a typedef for a field for an integer between two values
Export:
Param | Type | Description |
---|---|---|
min | number |
the minimum permitted value |
max | number |
the maximum permitted value |
util/schema~optionalIntegerBetweenValues(min, max)
Kind: inner method of util/schema
Summary: returns a typedef for an optional field for an integer between two values
Export:
Param | Type | Description |
---|---|---|
min | number |
the minimum permitted value |
max | number |
the maximum permitted value |
any
util/schema~idParams(name) ⇒ Kind: inner method of util/schema
Summary: returns an array with a single object in which defines an _id path param
Returns: any
- the params array
Export:
Param | Type | Description |
---|---|---|
name | string |
the name of the field |
boolean
util/schema~checkParameters(context, params, schema) ⇒ Kind: inner method of util/schema
Summary: Check incoming parameters against a schema
Returns: boolean
- true
Throws:
-
400
on validation error
Export:
Param | Type | Description |
---|---|---|
context | any |
The this context |
params | any |
The incoming parameters |
schema | any |
A SimpleSchema schema |
Object
util/schema~positiveNumber() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for a field for a number with a minimum
permitted value greater than zero
Returns: Object
- typedef for number field with positive min value (> 0)
Export:
Object
util/schema~optionalPositiveNumber() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for an optional field for a number with a minimum
permitted value of zero
Returns: Object
- typedef for optional number field with positive min value (> 0)
Export:
Object
util/schema~positiveInteger() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for a field for an integer with a minimum
permitted value of zero
Returns: Object
- typedef for integer field with positive min value (> 0)
Export:
Object
util/schema~optionalPositiveInteger() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for an optional field for an integer with a minimum
permitted value of zero
Returns: Object
- typedef for optional integer field with positive min value (> 0)
Export:
Object
util/schema~immutable() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for a field that should not be updated once set
Returns: Object
- typedef for field with immutable value
Export:
Object
util/schema~optionalImmutable() ⇒ Kind: inner method of util/schema
Summary: returns a typedef for an optional field that should not be updated once set
Returns: Object
- typedef for optional field with immutable value
Export:
util/schema~alwaysArray()
Kind: inner method of util/schema
Summary: returns multiple typedefs for an array of elements of the given type
where the default value is always an empty array
Export:
util/config
util/config~Configuration
Kind: inner class of util/config
new Configuration(collection, Meteor, [Tracker], [connection])
A configuration class - provides a DB-backed, environment variable / meteor.settings populated set of config values
Param | Type | Description |
---|---|---|
collection | Mongo.Collection |
the config collection |
Meteor | Object |
a reference to the Meteor object |
[Tracker] | Object |
an optional reference to Tracker - will be mocked in a non-reactive way if not supplied |
[connection] | Object |
an optional override for the DDP connection to use to subscribe to the config pub |
util/config~StandaloneConfiguration
Kind: inner class of util/config
new StandaloneConfiguration()
A configuration class - provides an environment variable / codebase-populated set of config values
util/string
-
util/string
-
~capitalize(str) ⇒
string
-
~humanize(str) ⇒
string
-
~titleize(str) ⇒
string
-
~camelize(str) ⇒
string
-
~hyphenate(str) ⇒
string
-
~truncate(str, [count]) ⇒
string
-
~addThousandsSeparators(str) ⇒
string
-
~extname(filename) ⇒
string
-
~underscore(str) ⇒
string
-
~keyify(str, [replacer]) ⇒
string
-
~getDomain(str) ⇒
string
|null
-
~startsWith(haystack, needle) ⇒
boolean
-
~endsWith(haystack, needle) ⇒
boolean
-
~escapeRegExp(str) ⇒
string
-
~isEmail(str) ⇒
boolean
-
~isUrl(str) ⇒
boolean
-
~isIP(str) ⇒
boolean
-
~isIPv4(str) ⇒
boolean
-
~isIPv6(str) ⇒
boolean
-
~caseInsensitivePermutations(str) ⇒
Array.<string>
-
~nonEmpty(str) ⇒
boolean
-
~dedent(strings, values) ⇒
string
- ~formatPennies(amount, symbol)
-
~capitalize(str) ⇒
string
util/string~capitalize(str) ⇒ Kind: inner method of util/string
Summary: makes the first letter of a string
uppercase and the rest lowercase
Returns: string
- the capitalised string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to capitalise |
string
util/string~humanize(str) ⇒ Kind: inner method of util/string
Summary: Converts identifiers to more human-friendly
versions. e.g. helloWorld -> Hello world
Returns: string
- the human-friendly version of the
string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to humanise |
string
util/string~titleize(str) ⇒ Kind: inner method of util/string
Summary: converts each words' first letter
to uppercase.
Returns: string
- the titleized string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to titleize |
string
util/string~camelize(str) ⇒ Kind: inner method of util/string
Summary: converts a string of words to a lowerCamelCase word
Returns: string
- the camelized string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to camelize |
string
util/string~hyphenate(str) ⇒ Kind: inner method of util/string
Summary: converts spaces to hyphens
Returns: string
- the processed string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to perform the replacements on |
string
util/string~truncate(str, [count]) ⇒ Kind: inner method of util/string
Summary: limits the length of a string to count
(plus
three for dots)
Returns: string
- the possibly truncated string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to truncate |
[count] | number |
the maximum length of the string |
string
util/string~addThousandsSeparators(str) ⇒ Kind: inner method of util/string
Summary: Inserts a comma every three digits
Returns: string
- the formatted number
Export:
Param | Type | Description |
---|---|---|
str |
string | number
|
a number, represented as a string |
string
util/string~extname(filename) ⇒ Kind: inner method of util/string
Summary: gets the file extension from a file name
Returns: string
- the file extension
Export:
Param | Type | Description |
---|---|---|
filename | string |
the full filename. e.g. "movie.avi" |
string
util/string~underscore(str) ⇒ Kind: inner method of util/string
Summary: converts spaces to underscores in a string
Returns: string
- the processed string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to process |
string
util/string~keyify(str, [replacer]) ⇒ Kind: inner method of util/string
Summary: converts spaces to dashes/underscores &
lowercases the string for db values and filenames etc..
Returns: string
- the keyified string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to keyify |
[replacer] | string |
the character to use in place of spaces. Can be '-' or '_' |
string
| null
util/string~getDomain(str) ⇒ Kind: inner method of util/string
Summary: gets the domain from an email address
Returns: string
| null
- the domain, or null
Export:
Param | Type | Description |
---|---|---|
str | string |
the email address to test |
boolean
util/string~startsWith(haystack, needle) ⇒ Kind: inner method of util/string
Summary: Reports whether haystack
starts with needle
Returns: boolean
- whether haystack starts with needle
Export:
Param | Type | Description |
---|---|---|
haystack | string |
the string to search |
needle | string |
the substring to search for |
boolean
util/string~endsWith(haystack, needle) ⇒ Kind: inner method of util/string
Summary: Reports whether haystack
ends with needle
Returns: boolean
- whether haystack ends with needle
Export:
Param | Type | Description |
---|---|---|
haystack | string |
the string to search |
needle | string |
the substring to search for |
string
util/string~escapeRegExp(str) ⇒ Kind: inner method of util/string
Summary: Escapes special characters in a string, enabling
the string's use as a regex
Returns: string
- the escaped string
Export:
Param | Type | Description |
---|---|---|
str | string |
the string to escape |
boolean
util/string~isEmail(str) ⇒ Kind: inner method of util/string
Summary: determines whether a string looks like
an email address
Returns: boolean
- whether the string looks like an email
Export:
Param | Type | Description |
---|---|---|
str | string |
the potential email address |
boolean
util/string~isUrl(str) ⇒ Kind: inner method of util/string
Summary: determines whether a string looks like
a url
Returns: boolean
- whether the string looks like a url
Export:
Param | Type | Description |
---|---|---|
str | string |
the potential url |
boolean
util/string~isIP(str) ⇒ Kind: inner method of util/string
Summary: determins whether a string looks like
an ip address (either IPv4 or IPv6)
Returns: boolean
- whether the string looks like an ip
Export:
Param | Type | Description |
---|---|---|
str | string |
the potential ip address |
boolean
util/string~isIPv4(str) ⇒ Kind: inner method of util/string
Summary: determines whether a string looks like
an ip address
Returns: boolean
- whether the string looks like an ip
Export:
Param | Type | Description |
---|---|---|
str | string |
the potential ip address |
boolean
util/string~isIPv6(str) ⇒ Kind: inner method of util/string
Summary: determines whether a string looks like
an ip address
Returns: boolean
- whether the string looks like an ip
Export:
Param | Type | Description |
---|---|---|
str | string |
the potential ip address |
Array.<string>
util/string~caseInsensitivePermutations(str) ⇒ Kind: inner method of util/string
Summary: generates permutations of all case variations of a given string.
Returns: Array.<string>
- an array of permutations
Export:
Param | Type | Description |
---|---|---|
str | string |
The string to get permutations of |
boolean
util/string~nonEmpty(str) ⇒ Kind: inner method of util/string
Summary: Check if something is a string and non-empty
Returns: boolean
- whether the provided value is a string and has a length
Export:
Param | Type | Description |
---|---|---|
str | any |
the string to check |
string
util/string~dedent(strings, values) ⇒ Kind: inner method of util/string
Summary: Remove leading indents from a template string without removing all leading whitespace
Returns: string
- the processed string
Export:
Param | Type | Description |
---|---|---|
strings | TemplateStringsArray |
the string parts |
values | Array.<any> |
templating variables for interpolation |
util/string~formatPennies(amount, symbol)
Formats an amount in pennies to £x.xx
Kind: inner method of util/string
Param | Type | Default | Description |
---|---|---|---|
amount | number |
||
symbol | string |
"£" |
override for custom prefixed symbol, defaults to '£' |