Skip to content

Instantly share code, notes, and snippets.

@mikkoh
Created April 7, 2015 15:11
Show Gist options
  • Save mikkoh/8ad1a37b786e6155a0aa to your computer and use it in GitHub Desktop.
Save mikkoh/8ad1a37b786e6155a0aa to your computer and use it in GitHub Desktop.
requirebin sketch
var fill = require('lodash/array/fill');
var arr = fill(new Array(10), function() { return 'test' });
var arr2 = fill(new Array(10), 'test');
document.body.innerHTML = JSON.stringify(arr) + JSON.stringify(arr2);
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){function baseFill(array,value,start,end){var length=array.length;start=start==null?0:+start||0;if(start<0){start=-start>length?0:length+start}end=typeof end=="undefined"||end>length?length:+end||0;if(end<0){end+=length}length=start>end?0:end>>>0;start>>>=0;while(start<length){array[start++]=value}return array}module.exports=baseFill},{}],2:[function(require,module,exports){var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}module.exports=isIndex},{}],3:[function(require,module,exports){var isIndex=require("./isIndex"),isLength=require("./isLength"),isObject=require("../lang/isObject");function isIterateeCall(value,index,object){if(!isObject(object)){return false}var type=typeof index;if(type=="number"){var length=object.length,prereq=isLength(length)&&isIndex(index,length)}else{prereq=type=="string"&&index in object}if(prereq){var other=object[index];return value===value?value===other:other!==other}return false}module.exports=isIterateeCall},{"../lang/isObject":5,"./isIndex":2,"./isLength":4}],4:[function(require,module,exports){var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}module.exports=isLength},{}],5:[function(require,module,exports){function isObject(value){var type=typeof value;return type=="function"||!!value&&type=="object"}module.exports=isObject},{}],"lodash/array/fill":[function(require,module,exports){var baseFill=require("../internal/baseFill"),isIterateeCall=require("../internal/isIterateeCall");function fill(array,value,start,end){var length=array?array.length:0;if(!length){return[]}if(start&&typeof start!="number"&&isIterateeCall(array,value,start)){start=0;end=length}return baseFill(array,value,start,end)}module.exports=fill},{"../internal/baseFill":1,"../internal/isIterateeCall":3}]},{},[]);var fill=require("lodash/array/fill");var arr=fill(new Array(10),function(){return"test"});var arr2=fill(new Array(10),"test");document.body.innerHTML=JSON.stringify(arr)+JSON.stringify(arr2);
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"lodash": "3.6.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment