This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
, fs = require('fs') | |
, deferred = require('deferred'), delay = deferred.delay | |
, promisify = deferred.promisify | |
, lstat = promisify(fs.lstat), unlink = promisify(fs.unlink), readdir = promisify(fs.readdir) | |
, rmdir = promisify(fs.rmdir) | |
var timeout = 0; | |
var rimraf = module.exports = function (p, opts) { | |
opts = opts || {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ### function randomString (bits) | |
// #### @bits {integer} The number of bits for the random base64 string returned to contain | |
// randomString returns a pseude-random ASCII string which contains at least the specified number of bits of entropy | |
// the return value is a string of length ⌈bits/6⌉ of characters from the base64 alphabet | |
// | |
helpers.randomString = exports.randomString = function (bits) { | |
var chars, rand, i, ret; | |
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("1. zip"); | |
for (const [i, x] of zip(naturalNumbers(), naturalNumbers())) { | |
console.log(i, x); | |
} | |
console.log("2. Array.from"); | |
Array.from(naturalNumbers(), function (x, i) { | |
console.log(i, x); | |
}); |