-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ESM conversion * ES6 transformations * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update Bower dependencies to master or main * Update pulp to 16.0.0-0 * Update psa to 0.8.2 * Update Bower dependencies to master or main * Add eslint config * Fix eslint errors * Update changelog * Update ci.yml to v2 Co-authored-by: Nicholas Wolverson <nicholas.wolverson@gmail.com>
- Loading branch information
1 parent
c59deb3
commit dff666d
Showing
6 changed files
with
54 additions
and
63 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,51 @@ | ||
"use strict"; | ||
|
||
// module Node.ReadLine | ||
|
||
exports.createInterfaceImpl = function (options) { | ||
return function () { | ||
var readline = require("readline"); | ||
return readline.createInterface({ | ||
input: options.input, | ||
output: options.output, | ||
completer: | ||
options.completer && | ||
function (line) { | ||
var res = options.completer(line)(); | ||
return [res.completions, res.matched]; | ||
}, | ||
terminal: options.terminal, | ||
historySize: options.historySize, | ||
}); | ||
}; | ||
}; | ||
import { createInterface } from "readline"; | ||
|
||
exports.close = function (readline) { | ||
return function () { | ||
export function createInterfaceImpl(options) { | ||
return () => createInterface({ | ||
input: options.input, | ||
output: options.output, | ||
completer: options.completer && (line => { | ||
const res = options.completer(line)(); | ||
return [res.completions, res.matched]; | ||
}), | ||
terminal: options.terminal, | ||
historySize: options.historySize, | ||
}); | ||
} | ||
|
||
export function close(readline) { | ||
return () => { | ||
readline.close(); | ||
}; | ||
}; | ||
} | ||
|
||
exports.prompt = function (readline) { | ||
return function () { | ||
export function prompt(readline) { | ||
return () => { | ||
readline.prompt(); | ||
}; | ||
}; | ||
} | ||
|
||
exports.question = function (text) { | ||
return function (callback) { | ||
return function (readline) { | ||
return function () { | ||
readline.question(text, function (result) { | ||
callback(result)(); | ||
}); | ||
}; | ||
}; | ||
export function question(text) { | ||
return callback => readline => () => { | ||
readline.question(text, result => { | ||
callback(result)(); | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
exports.setPrompt = function (prompt) { | ||
return function (readline) { | ||
return function () { | ||
readline.setPrompt(prompt); | ||
}; | ||
export function setPrompt(prompt) { | ||
return readline => () => { | ||
readline.setPrompt(prompt); | ||
}; | ||
}; | ||
} | ||
|
||
exports.setLineHandler = function (callback) { | ||
return function (readline) { | ||
return function () { | ||
readline.removeAllListeners("line"); | ||
readline.on("line", function (line) { | ||
callback(line)(); | ||
}); | ||
}; | ||
export function setLineHandler(callback) { | ||
return readline => () => { | ||
readline.removeAllListeners("line"); | ||
readline.on("line", line => { | ||
callback(line)(); | ||
}); | ||
}; | ||
}; | ||
} |