Ai
2 Star 0 Fork 0

mirrors_WebReflection/packed-array

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.js 766 Bytes
一键复制 编辑 原始数据 按行查看 历史
Andrea Giammarchi 提交于 2020-02-12 21:34 +08:00 . forgot the self
var packedArray = (function (exports) {
'use strict';
/**
* An utility to created packed arrays
*
* @param {(number | Array)} sizer - Either the length of the new Array or an Array
* @param {(Function | any)} filler - Either a function to invoke per each index, or a value to fill the Array
* @param {any=undefined} self - The context to use via the `filler`, if it's a Function
* @return {Array<filler>} The Array of length `sizer` filled via the `filler`
*/
var index = (function (sizer, filler, self) {
return Array.from(typeof sizer === 'number' ? Array(sizer) : sizer, typeof filler === 'function' ? filler : function () {
return filler;
}, self);
});
exports.default = index;
return exports;
}({}).default);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_WebReflection/packed-array.git
git@gitee.com:mirrors_WebReflection/packed-array.git
mirrors_WebReflection
packed-array
packed-array
master

搜索帮助