1.0.1 • Published 3 years ago

miniprogram-properties-reset v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

miniprogram-properties-reset

yarn add miniprogram-properties-reset
// in Miniprogram
const MPReset = require("miniprogram-properties-reset")

Component({
  behaviors: [MPReset],

  properties: {
    iString: String,
    iNumber: Number,
    iBoolean: Boolean,
    iArray: Array,
    iObject: Object,
    iJson: {
      type: Object,
      value: {
        key: `value`
      }
    }
  },

  ready() {
    const mock = this.APTReset({
      iString: 100,
      iNumber: `miniprogram`,
      iBoolean: true,
      iArray: ["a", "b", "c"],
      iObject: null,
      iJson: null
    })

    console.log(mock)

    /**
     * {
     *   iString: '',
     *   iNumber: 0,
     *   iBoolean: true,
     *   iArray: ['a', 'b', 'c'],
     *   iObject: {},
     *   iJson: {
     *     key: `value`
     *   }
     * }
     */
  }
})
// Built-In

{
  [String]: '',
  [Number]: 0,
  [Boolean]: false,
  [Array]: [],
  [Object]: {},
  [Function]: function() {}
}