Documentation
- Add ARGS (deno.args) carpenter
- Add OS (deno.build) carpenter
- Add STRING carpenter
- Add ARRAY carpenter
- Add SWITCH carpenter
- Add OBJECT carpenter
- Add VALUE carpenter (unknown values)
- Add more options to STRING carpenter
- Add more interconnections between various carpenters
import { OS } from "./mod.ts";
// basic
OS.on("darwin").do(() => console.log("Hey Darwin"));
OS.on("darwin").do(() => console.log("Hey Darwin")).else(() =>
console.log("something else")
);
// multiple clauses
let str = "";
OS.on("windows")
.do(() => str += "Hello ")
.do(() => str += "world");
import {ARGS} from "./mod.ts";
// basic usage
ARGS.on("-h")
.do(() => some help code here)
.else(() => -h was not found);
// multiple flags (evaluates when all flags are set)
ARGS.on("-x", "-a")
.do(()=> console.log("flag -x and -a was found together"))
For more carpenters see documentation.
import { STRING } from "./mod.ts";
STRING("hello")
.contains("hello").and().contains("x") // false
.or().isOfSize(5) // true
.do(() => console.log("OH WOW!!!!")) // true because of OR operator
;
STRING("hello")
.adapt((prev: string) => prev += " world") // adapts the string.. you may continue with chaining after this
.getValue(); // gets the current object value.
import { SWITCH } from "./mod.ts";
SWITCH(someValue)
.case("one").do(() => {})
.case("chain")
.do(() => {})
.do(() => {})
.default(() => {});