Mementifier defaults

    0

    2

    Michael Born

    The code defines a field named "defaultIncludes" and a field named "defaults" in the instance of the Memento class. The "defaultIncludes" field contains an array of strings which are automatically included in every getMemento() call on the instance. The "defaults" field contains an object which can be used to override the default values for the "name" and "description" fields.

    Library: Mementifier

    Shortcut: memento

    this.memento = {
      // An array of the properties/relationships to include by default
      defaultIncludes =
      [
        "id",
        "name",
        "isPrimary"
      ],
      // An array of properties/relationships to exclude by default
      defaultExcludes = [],
      // An array of properties/relationships to NEVER include
      neverInclude = [],
      // A struct of defaults for properties/relationships if they are null
      defaults = {
        "name" : "",
        "isPrimary" : false
      },
      // A struct of mapping functions for properties/relationships that can transform them
      mappers = {}
    };
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.