-
-
Save jfsiii/10600048 to your computer and use it in GitHub Desktop.
Trying some examples from http://raganwald.com/2013/04/19/another-look-at-sequence.html with allong.es
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 allong = require('allong.es'); | |
var ƒ = allong.es; | |
var fs = require('fs'); | |
ƒ.sequence(ƒ.sequence.Callback, | |
ƒ.callLeft(fs.mkdir, './hello', 0777), | |
ƒ.callLeft(fs.writeFile, './hello/world.txt', 'Hello!'), | |
function (callback) { fs.readFile('./hello/world.txt', 'UTF-8', callback); } | |
)()(function(err, data) { | |
if (err) throw err; | |
console.log('DATA:', data); | |
}) | |
/* | |
TypeError: undefined is not a function | |
at repl:5:4 | |
at REPLServer.self.eval (repl.js:110:21) | |
at Interface.<anonymous> (repl.js:239:12) | |
at Interface.EventEmitter.emit (events.js:95:17) | |
at Interface._onLine (readline.js:202:10) | |
at Interface._line (readline.js:531:8) | |
at Interface._ttyWrite (readline.js:760:14) | |
at ReadStream.onkeypress (readline.js:99:10) | |
at ReadStream.EventEmitter.emit (events.js:98:17) | |
at emitKey (readline.js:1095:12) | |
> fs: missing callback Error: ENOENT, open './hello/world.txt' | |
*/ |
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 allong = require('allong.es'); | |
var ƒ = allong.es; | |
var fs = require('fs'); | |
ƒ.pipeline(ƒ.sequence.Callback, | |
ƒ.callLeft(fs.mkdir, './hello', 0777), | |
ƒ.callLeft(fs.writeFile, './hello/world.txt', 'Hello!'), | |
function (callback) { fs.readFile('./hello/world.txt', 'UTF-8', callback); } | |
)()(function(err, data) { | |
if (err) throw err; | |
console.log('DATA:', data); | |
}) | |
/* | |
TypeError: Property '3' of object function (callback) { fs.readFile('./hello/world.txt', 'UTF-8', callback); },function binary(a, b) { | |
if (a == null) { | |
return binary; | |
} | |
else if (b == null) { | |
return unary(function (b) { return fn(a, b); }); | |
} | |
else return fn(a, b); | |
},function unary(a) { | |
if (a == null) { | |
return unary; | |
} | |
else return fn(a); | |
}, is not a function | |
at /Users/jschulz/node_modules/allong.es/lib/allong.es.js:444:25 | |
at repl:5:2 | |
at REPLServer.self.eval (repl.js:110:21) | |
at Interface.<anonymous> (repl.js:239:12) | |
at Interface.EventEmitter.emit (events.js:95:17) | |
at Interface._onLine (readline.js:202:10) | |
at Interface._line (readline.js:531:8) | |
at Interface._ttyWrite (readline.js:760:14) | |
at ReadStream.onkeypress (readline.js:99:10) | |
at ReadStream.EventEmitter.emit (events.js:98:17) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have duplicated the issue, but do not have time to address it today. So... I've taken the blog post down until it and/or allong.es can be corrected. Thanks for the heads up that it is not working!
See: raganwald/allong.es#20