Sha256: 5e02b4b429a334720f3412757cacb5e4769d8fea1fde86acdd196e996225f387

Contents?: true

Size: 833 Bytes

Versions: 320

Compression:

Stored size: 833 Bytes

Contents

// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
'use strict';
var toObject = require('./_to-object')
  , toIndex  = require('./_to-index')
  , toLength = require('./_to-length');

module.exports = [].copyWithin || function copyWithin(target/*= 0*/, start/*= 0, end = @length*/){
  var O     = toObject(this)
    , len   = toLength(O.length)
    , to    = toIndex(target, len)
    , from  = toIndex(start, len)
    , end   = arguments.length > 2 ? arguments[2] : undefined
    , count = Math.min((end === undefined ? len : toIndex(end, len)) - from, len - to)
    , inc   = 1;
  if(from < to && to < from + count){
    inc  = -1;
    from += count - 1;
    to   += count - 1;
  }
  while(count-- > 0){
    if(from in O)O[to] = O[from];
    else delete O[to];
    to   += inc;
    from += inc;
  } return O;
};

Version data entries

320 entries across 8 versions & 3 rubygems

Version Path
affiliator-0.2.1 node_modules/core-js/library/modules/_array-copy-within.js
affiliator-0.2.1 node_modules/core-js/modules/_array-copy-within.js
lanes-0.8.0 node_modules/babel-register/node_modules/core-js/modules/_array-copy-within.js
lanes-0.8.0 node_modules/babel-runtime/node_modules/core-js/library/modules/_array-copy-within.js
lanes-0.8.0 node_modules/babel-runtime/node_modules/core-js/modules/_array-copy-within.js
lanes-0.8.0 node_modules/babel-register/node_modules/core-js/library/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-get-function-arity/node_modules/core-js/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-function-name/node_modules/core-js/library/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-hoist-variables/node_modules/core-js/library/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-call-delegate/node_modules/core-js/library/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-generator/node_modules/core-js/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-define-map/node_modules/core-js/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-function-name/node_modules/core-js/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-get-function-arity/node_modules/core-js/library/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-helper-call-delegate/node_modules/core-js/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-core/node_modules/core-js/library/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-core/node_modules/core-js/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-code-frame/node_modules/core-js/library/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-code-frame/node_modules/core-js/modules/_array-copy-within.js
babel-schmooze-sprockets-0.1.3 node_modules/babel-generator/node_modules/core-js/library/modules/_array-copy-within.js