Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

114 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Carpenter πŸ› 

Documentation

Road πŸ—Ί

  • 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

By example

OS specific code

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");

Command line argument specific code

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"))

Other carpenters

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(() => {});

About

Method chaining pattern for all things Deno

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /