You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
563 B

4 years ago
  1. 'use strict';
  2. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  3. module.exports = function wrap(value) {
  4. if (value instanceof this.constructor) {
  5. return value;
  6. }
  7. if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
  8. return new this.constructor(value);
  9. }
  10. return new this.constructor([value]);
  11. };