From f5a6d10ce4001944918b8cf8ede8b524b56b1661 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sat, 8 Oct 2016 14:43:39 -0400 Subject: [PATCH] updated flow types [ci skip] --- .flowconfig | 4 ++++ bin/printj.njs | 6 +++--- bits/flow.js | 12 +++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.flowconfig b/.flowconfig index c7ed5b9..ed817f1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -11,9 +11,11 @@ .*/stress/.* .*/demo/browser.js +.*/shim.js [include] printj.flow.js +.*/bin/.*.njs lib/loop_code.js lib/loop_char.js lib/index_code.js @@ -24,3 +26,5 @@ lib/regex.js bits/flow.js [options] +module.file_ext=.js +module.file_ext=.njs diff --git a/bin/printj.njs b/bin/printj.njs index 7810b18..761e414 100755 --- a/bin/printj.njs +++ b/bin/printj.njs @@ -47,13 +47,13 @@ function parse_arg(arg/*:string*/)/*:any*/ { var args/*:Array*/ = []; var fmt = "", n = 0; for(var i = 2; i < argv.length; ++i) switch(argv[i]) { - case "--help": case "-h": return help(); - case "--dump": case "-d": if(fmt.length==0) fmt = argv[++i]; return dump(fmt); + case "--help": case "-h": process.exit(help()); + case "--dump": case "-d": if(fmt.length==0) fmt = argv[++i]; process.exit(dump(fmt)); default: if(n++ == 0) fmt = argv[i]; else args.push(parse_arg(argv[i])); } console.log(X.vsprintf(fmt, args)); -return 0; +process.exit(0); function dump(fmt) { if(!fmt) { console.error("printj: missing format argument"); return 1; } diff --git a/bits/flow.js b/bits/flow.js index 0f9392b..27037f3 100644 --- a/bits/flow.js +++ b/bits/flow.js @@ -2,10 +2,12 @@ type ParsedFmt = Array>; type Args = Array; declare module "exit-on-epipe" { }; -declare module "./" { - declare function sprintf(fmt:string, ...args:any):string; - declare function vsprintf(fmt:string, args:Args):string; - declare function _doit(t:ParsedFmt, args:Args):string; - declare function _tokenize(fmt:string):ParsedFmt; +declare class PRINTJModule { + sprintf(fmt:string, ...args:any):string; + vsprintf(fmt:string, args:Args):string; + _doit(t:ParsedFmt, args:Args):string; + _tokenize(fmt:string):ParsedFmt; }; +declare module "./" { declare var exports:PRINTJModule }; +declare module "../" { declare var exports:PRINTJModule }; */