Model

Model

new Model()

Description:
  • Base Model for all entities.

Source:

Members

guid

Description:
  • A unique identifier for this model instance.

Source:
Properties:
Name Type Description
guid String

A unique identifier for this model instance.

tags

Description:
  • An array of string tags that characterize this item.

Source:
Properties:
Name Type Description
tags Set

An array of string tags that characterize this item.

Methods

asJSON() → {String}

Description:
  • Converts the model to JSON, converting sets to arrays.

Source:
Returns:

JSON

Type
String

has(tag) → {Boolean}

Description:
  • Does this model have the given tag?

Source:
Parameters:
Name Type Description
tag String
Returns:

true if it does, false otherwise

Type
Boolean

is(tag) → {Boolean}

Description:
  • Does this model have the given tag?

Source:
Deprecated:
  • Use has() instead
Parameters:
Name Type Description
tag String
Returns:

true if it does, false otherwise

Type
Boolean

matches(model) → {Boolean}

Description:
  • Compares this model to another for value equality, ignoring their guids. Two independently-created models with the same properties (e.g. two identical items generated separately) will match even though they have different guids.

Source:
Parameters:
Name Type Description
model Model
Returns:

true if the models are equal in every respect except guid

Type
Boolean

not(tag) → {Boolean}

Description:
  • Does this model not have the given tag?

Source:
Parameters:
Name Type Description
tag String
Returns:

true if it does not have the tag, false otherwise

Type
Boolean

typeOf(prefix) → {String}

Description:
  • Given a prefix like ammo or media, will return the specific tag for this item, such as ammo:22 or media:35mm.

Source:
Parameters:
Name Type Description
prefix String

the prefix to match

Returns:

the first tag found that matches this prefix

Type
String

Model

new Model(params)

Source:
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
tags Array.<String> <optional>

an array of tags to add to this model instance.

guid String <optional>

a unique identifier for this model instance. Generated automatically if not provided.

Members

guid

Description:
  • A unique identifier for this model instance.

Source:
Properties:
Name Type Description
guid String

A unique identifier for this model instance.

tags

Description:
  • An array of string tags that characterize this item.

Source:
Properties:
Name Type Description
tags Set

An array of string tags that characterize this item.

Methods

asJSON() → {String}

Description:
  • Converts the model to JSON, converting sets to arrays.

Source:
Returns:

JSON

Type
String

has(tag) → {Boolean}

Description:
  • Does this model have the given tag?

Source:
Parameters:
Name Type Description
tag String
Returns:

true if it does, false otherwise

Type
Boolean

is(tag) → {Boolean}

Description:
  • Does this model have the given tag?

Source:
Deprecated:
  • Use has() instead
Parameters:
Name Type Description
tag String
Returns:

true if it does, false otherwise

Type
Boolean

matches(model) → {Boolean}

Description:
  • Compares this model to another for value equality, ignoring their guids. Two independently-created models with the same properties (e.g. two identical items generated separately) will match even though they have different guids.

Source:
Parameters:
Name Type Description
model Model
Returns:

true if the models are equal in every respect except guid

Type
Boolean

not(tag) → {Boolean}

Description:
  • Does this model not have the given tag?

Source:
Parameters:
Name Type Description
tag String
Returns:

true if it does not have the tag, false otherwise

Type
Boolean

typeOf(prefix) → {String}

Description:
  • Given a prefix like ammo or media, will return the specific tag for this item, such as ammo:22 or media:35mm.

Source:
Parameters:
Name Type Description
prefix String

the prefix to match

Returns:

the first tag found that matches this prefix

Type
String