Home Manual Reference Source

Function

Static Public Summary
public

A function to return all basic dummy data, i.e.

public

dummyBasicDataExcept(excludeTypes: ...string): DummyData[]

A function to return all basic dummy data except those for zero or more given types.

public

A function to return all basic dummy data that's not an object, i.e. all dummy data tagged basic that does not have either the type or tag object.

public

A function to return all basic dummy primitives except those for zero or more given types.

public

Returns a single piece of dummy data, or, all the dummy data for a given type, or all the dummy data.

public

dummyDataByType(typeList: ...string): DummyData[]

Returns the dummy data of one or more types.

public

dummyDataExcept(excludeTypes: string[], excludeTags: string[], excludeDefinitions: string[]): DummyData[]

A function to return all dummy data except those for the given types and those matching the given tags tags.

public

Returns the dummy data matching all of the given tags.

public

Returns the dummy data matching any of the given tags.

public

refreshDummyData(dataGenerators: function(): Map<string, Map<string, Array>>)

Refresh the dummy data.

Static Public

public dummyBasicData(): DummyData[] source

A function to return all basic dummy data, i.e. all dummy data tagged basic.

This is a shortcut for dummyDataWithAnyTag('basic').

Return:

DummyData[]

public dummyBasicDataExcept(excludeTypes: ...string): DummyData[] source

A function to return all basic dummy data except those for zero or more given types.

Params:

NameTypeAttributeDescription
excludeTypes ...string

Return:

DummyData[]

public dummyBasicPrimitives(): DummyData[] source

A function to return all basic dummy data that's not an object, i.e. all dummy data tagged basic that does not have either the type or tag object.

Return:

DummyData[]

public dummyBasicPrimitivesExcept(excludeTypes: ...string): DummyData[] source

A function to return all basic dummy primitives except those for zero or more given types.

Params:

NameTypeAttributeDescription
excludeTypes ...string

Return:

DummyData[]

public dummyData(path: string, opts: object): DummyData[] | DummyData | undefined source

Returns a single piece of dummy data, or, all the dummy data for a given type, or all the dummy data.

To get a single piece of dummy data pass its type and tag path as a single period-separated string, e.g. 'string.word' for the dummy data with type string and tag path word, or 'number.integer.negative' for the dummy data with type number and tag path integer.negative.

To get all the dummy data for a given type pass the type as a string, e.g. 'boolean' for all dummy boolean data.

To get all the dummy data, simply pass '*'.

When querying all the dummy data both entire sections and specific tags can be excluded, and when querying all the dummy data for a sigle type specific tags can be excluded.

Params:

NameTypeAttributeDescription
path string

a type, or, a type and tag path as a single period-separated string, or the special value '*'.

opts object
  • optional

an optional options object.

opts.excludeTypes string[]
  • optional

a list of types to exclude when requesting all dummy data (path is '*').

opts.excludeTags string[]
  • optional

a list of tags to exclude when requesting all dummy data, or the dummy data for a given type.

opts.excludeDefinitions string[]
  • optional

a list of individual data definitions to exclude as period-separated type and tag path strings.

Return:

DummyData[] | DummyData | undefined

Returns all the dummy data for a given type, or a single piece of dummy data for a type with tag path. If only a type is passed and that type does not exist an empty array is returned, if the path has two or more parts and the type or tag path don't exist, undefined is returned.

Throw:

TypeError

public dummyDataByType(typeList: ...string): DummyData[] source

Returns the dummy data of one or more types.

Params:

NameTypeAttributeDescription
typeList ...string

Return:

DummyData[]

Throw:

TypeError

public dummyDataExcept(excludeTypes: string[], excludeTags: string[], excludeDefinitions: string[]): DummyData[] source

A function to return all dummy data except those for the given types and those matching the given tags tags.

This is a shortcut for:

.dummyData(
    '*',
    {
        excludeTypes: arguments[0],
        excludeTags: arguments[1],
        excludeDefinitions: arguments[2]
    }
)

Params:

NameTypeAttributeDescription
excludeTypes string[]
  • optional
excludeTags string[]
  • optional
excludeDefinitions string[]
  • optional

Return:

DummyData[]

public dummyDataWithAllTags(tagList: ...string): DummyData[] source

Returns the dummy data matching all of the given tags.

Params:

NameTypeAttributeDescription
tagList ...string

Return:

DummyData[]

Throw:

TypeError

public dummyDataWithAnyTag(tagList: ...string): DummyData[] source

Returns the dummy data matching any of the given tags.

Params:

NameTypeAttributeDescription
tagList ...string

Return:

DummyData[]

Throw:

TypeError

public refreshDummyData(dataGenerators: function(): Map<string, Map<string, Array>>) source

Refresh the dummy data.

Params:

NameTypeAttributeDescription
dataGenerators function(): Map<string, Map<string, Array>>

references to zero or more functions that return additional dummy data beyond the default set. The generators must return a data structure containing three-element arrays indexed by tag path indexed by type. The first element in the arrays must be a textual description of the piece of dummy data, the second a list of additional tags as an array of strings (the tags that make up the tag path should not be included), and the dummy data value. E.g.:

function muDummyDataGen(){
    return {
        number: {
            'mu.studentNumber': ['a student number', ['integer'], 99999999]
        },
        string: {
            'mu.studentNumber': ['a student number string', ['integer', 'numeric'], '99999999']
        }
    };
}