@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 891 B
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./../assert/is-array.js";import e from"./../assert/is-typed-array-like.js";import t from"./../assert/is-integer.js";function n(r){var e,t,n;if(0===r.length)return[r,void 0];for(e=r.length-1,t=r[0],n=0;n<e;n++)r[n]=r[n+1];return delete r[e],r.length=e,[r,t]}function i(r){var e,t;return 0===r.length?[r,void 0]:(t=r[0],e=r.byteOffset+r.BYTES_PER_ELEMENT,[new r.constructor(r.buffer,e,r.length-1),t])}var a=r,o=e,f=t,u=n,l=i;function s(r){var e;if(a(r))return e=r.shift(),[r,e];if(o(r))return l(r);if(null!==r&&"object"==typeof r&&"number"==typeof r.length&&f(r.length)&&r.length>=0)return u(r);throw new TypeError("invalid argument. Must provide either an Array, Typed Array, or an array-like Object. Value: `"+r+"`.")}var h=s;export default h;
//# sourceMappingURL=shift.js.map