Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides utility methods and constants for core object types.

Hierarchy

  • CoreTypes

Index

Constructors

constructor

Properties

Static Readonly OBJECT_TYPE_ANNOTATION

OBJECT_TYPE_ANNOTATION: string = ...

Static Readonly OBJECT_TYPE_IDENTITY

OBJECT_TYPE_IDENTITY: string = ...

Static Readonly OBJECT_TYPE_IO_ACTOR

OBJECT_TYPE_IO_ACTOR: string = ...

Static Readonly OBJECT_TYPE_IO_CONTEXT

OBJECT_TYPE_IO_CONTEXT: string = ...

Static Readonly OBJECT_TYPE_IO_NODE

OBJECT_TYPE_IO_NODE: string = ...

Static Readonly OBJECT_TYPE_IO_SOURCE

OBJECT_TYPE_IO_SOURCE: string = ...

Static Readonly OBJECT_TYPE_LOCATION

OBJECT_TYPE_LOCATION: string = ...

Static Readonly OBJECT_TYPE_LOG

OBJECT_TYPE_LOG: string = ...

Static Readonly OBJECT_TYPE_OBJECT

OBJECT_TYPE_OBJECT: string = ...

Static Readonly OBJECT_TYPE_PREFIX

OBJECT_TYPE_PREFIX: "coaty." = "coaty."

Static Readonly OBJECT_TYPE_SNAPSHOT

OBJECT_TYPE_SNAPSHOT: string = ...

Static Readonly OBJECT_TYPE_TASK

OBJECT_TYPE_TASK: string = ...

Static Readonly OBJECT_TYPE_USER

OBJECT_TYPE_USER: string = ...

Methods

Static asObject

  • Returns the given object if has the shape of a concrete subtype of CoatyObject, i.e. satisfies the concrete interface defined by the object's coreType property or the specified coreType parameter. Otherwise, undefined is returned.

    Parameters

    • obj: any

      any

    • Optional coreType: CoreType

      a framework core type to check for (optional)

    Returns CoatyObject

Static clone

  • clone<T>(obj: T, shouldSkipValidation?: boolean): T
  • Returns a deep copy of the specified CoatyObject according to JSON conventions. If the object passed in is undefined, undefined is returned. Note that all (own and inherited) enumerable properties of the given object are copied, not only the properties defined in the interface definition of the corresponding core type. Properties are copied according to JSON data type conventions. In effect, this clone method always yields the same result as JSON.parse(JSON.stringify(obj)).

    Note: by default the passed in argument is validated to conform to a framework core type. This method throws a TypeError if the given argument is not a valid CoatyObject. To skip this validation test, use the shouldSkipValidation argument.

    Type parameters

    Parameters

    • obj: T

      a CoatyObject to clone or undefined

    • shouldSkipValidation: boolean = false

    Returns T

Static getCoreTypeFor

  • getCoreTypeFor(objectType: string): string
  • Gets the core type for the given core object type, or undefined if the given object type doesn't represent a core object.

    Parameters

    • objectType: string

      an object type string

    Returns string

Static getCoreTypes

  • getCoreTypes(): any[]

Static getObjectTypeFor

  • getObjectTypeFor(coreType: CoreType): string

Static isCoreObjectType

  • isCoreObjectType(type: string): boolean
  • Determines whether the given type string defines a framework core object type.

    Parameters

    • type: string

      a type string

    Returns boolean

Static isCoreType

  • isCoreType(type: string): boolean
  • Determines whether the given type string defines a framework core type.

    Parameters

    • type: string

      a type string

    Returns boolean

Static isCoreTypeArray

  • isCoreTypeArray(obj: any): boolean
  • Determines whether the specified value is an array of CoreType strings.

    Parameters

    • obj: any

    Returns boolean

Static isDate

  • isDate(obj: any): boolean
  • Determines wether the given parameter is a Date

    Parameters

    • obj: any

      any

    Returns boolean

Static isObject

  • isObject(obj: any, coreType?: CoreType): boolean
  • Determines whether the given object has the shape of a concrete subtype of CoatyObject, i.e. satisfies either the concrete interface defined by the object's coreType property or the specified coreType parameter.

    Parameters

    • obj: any

      any

    • Optional coreType: CoreType

      a framework core type to check for (optional)

    Returns boolean

Static isObjectArray

  • Determines whether the specified value is an array of objects of the given core type(s) or of the core type specified on each object.

    Parameters

    • obj: any

      any

    • Optional coreType: CoreType | CoreType[]

      a framework core type or an array of core types

    Returns boolean

Static isStringArray

  • isStringArray(obj: any): boolean
  • Determines whether the specified value is an array of non-empty strings.

    Parameters

    • obj: any

      any

    Returns boolean

Generated using TypeDoc