Base.js 882 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. var stringify = require('./_stringify');
  4. var Base = function Base(source) {
  5. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  6. _ref$defaultValue = _ref.defaultValue,
  7. defaultValue = _ref$defaultValue === undefined ? {} : _ref$defaultValue,
  8. _ref$serialize = _ref.serialize,
  9. serialize = _ref$serialize === undefined ? stringify : _ref$serialize,
  10. _ref$deserialize = _ref.deserialize,
  11. deserialize = _ref$deserialize === undefined ? JSON.parse : _ref$deserialize;
  12. _classCallCheck(this, Base);
  13. this.source = source;
  14. this.defaultValue = defaultValue;
  15. this.serialize = serialize;
  16. this.deserialize = deserialize;
  17. };
  18. module.exports = Base;