a zip code crypto-currency system good for red ONLY

_initCloneArray.js 692B

123456789101112131415161718192021222324252627
  1. /** Used for built-in method references. */
  2. var objectProto = Object.prototype;
  3. /** Used to check objects for own properties. */
  4. var hasOwnProperty = objectProto.hasOwnProperty;
  5. /**
  6. * Initializes an array clone.
  7. *
  8. * @private
  9. * @param {Array} array The array to clone.
  10. * @returns {Array} Returns the initialized clone.
  11. */
  12. function initCloneArray(array) {
  13. var length = array.length,
  14. result = new array.constructor(length);
  15. // Add properties assigned by `RegExp#exec`.
  16. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  17. result.index = array.index;
  18. result.input = array.input;
  19. }
  20. return result;
  21. }
  22. module.exports = initCloneArray;