Sha256: 23d56c1359d190af0f10341a2f0a5548bceb0fe3ec31d30d5baae97e3adaf646

Contents?: true

Size: 709 Bytes

Versions: 69

Compression:

Stored size: 709 Bytes

Contents

define(function () {

    /**
     * Create slice of source array or array-like object
     */
    function slice(arr, start, end){
        var len = arr.length;

        if (start == null) {
            start = 0;
        } else if (start < 0) {
            start = Math.max(len + start, 0);
        } else {
            start = Math.min(start, len);
        }

        if (end == null) {
            end = len;
        } else if (end < 0) {
            end = Math.max(len + end, 0);
        } else {
            end = Math.min(end, len);
        }

        var result = [];
        while (start < end) {
            result.push(arr[start++]);
        }

        return result;
    }

    return slice;

});

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
trusty-festivity-extension-2.3.1 node_modules/bower/node_modules/mout/src/array/slice.js
trusty-festivity-extension-2.3.0 node_modules/bower/node_modules/mout/src/array/slice.js
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/mout/src/array/slice.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/mout/src/array/slice.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/mout/src/array/slice.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/mout/src/array/slice.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/mout/src/array/slice.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/mout/src/array/slice.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/mout/src/array/slice.js