{"id":32119790,"url":"https://github.com/trailmix/utilities","last_synced_at":"2026-05-06T01:35:56.609Z","repository":{"id":52638381,"uuid":"350136266","full_name":"trailmix/utilities","owner":"trailmix","description":"Repository of utilities for deno written in typescript for trailmix🌤🦕🍣😼","archived":false,"fork":false,"pushed_at":"2021-04-22T17:40:41.000Z","size":348,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-19T12:06:49.687Z","etag":null,"topics":["ansi","cliffy","colors","console","deno","environment","environment-variables","filesystem","string","table","terminal","testing-tools","typescript"],"latest_commit_sha":null,"homepage":"https://deno.land/x/trailmix","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trailmix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-21T22:31:00.000Z","updated_at":"2021-04-28T01:21:04.000Z","dependencies_parsed_at":"2022-08-21T23:20:52.243Z","dependency_job_id":null,"html_url":"https://github.com/trailmix/utilities","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/trailmix/utilities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailmix%2Futilities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailmix%2Futilities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailmix%2Futilities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailmix%2Futilities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trailmix","download_url":"https://codeload.github.com/trailmix/utilities/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailmix%2Futilities/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280143853,"owners_count":26279881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","cliffy","colors","console","deno","environment","environment-variables","filesystem","string","table","terminal","testing-tools","typescript"],"created_at":"2025-10-20T18:50:50.074Z","updated_at":"2025-10-20T18:50:53.579Z","avatar_url":"https://github.com/trailmix.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003etrailmix/utilities\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eRepository of utilities for deno written in typescript for trailmix🌤🦕🍣😼\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://deno.land\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Deno-1.9.0-brightgreen.svg?logo=deno\" alt=\"deno\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://deno.land/x/trailmix\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/utilities-v1.0.5-green.svg\" alt=\"trailmix utilities\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"http://djkittyplayz.art/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/art-djkittyplayz-yellow\" alt=\"art djkittyplayz\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://deno.land/x/trailmix\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/downloads/trailmix/utilities/total\" alt=\"downloads\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/trailmix/utilities/actions\"\u003e\n    \u003cimg src=\"https://github.com/trailmix/utilities/workflows/ci/badge.svg\" alt=\"ci\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://app.codecov.io/gh/trailmix/utilities\" align=\"left\"\u003e\n    \u003cimg\n      src=\"https://codecov.io/gh/trailmix/utilities/branch/master/graph/badge.svg?token=96CJ5IPAAN\"\n      alt=\"codecov master\"\n    /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://app.codecov.io/gh/trailmix/utilities/branch/next\" align=\"right\"\u003e\n    \u003cimg\n      src=\"https://codecov.io/gh/trailmix/utilities/branch/next/graph/badge.svg?token=96CJ5IPAAN\"\n      alt=\"codecov next\"\n    /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/trailmix/utilities/actions\"\u003e\n    \u003cimg src=\"https://github.com/trailmix/utilities/workflows/ci/badge.svg?branch=next\" alt=\"ci\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://app.codecov.io/gh/trailmix/utilities\" align=\"left\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/trailmix/utilities/branch/master/graphs/tree.svg\" alt=\"codecov master\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://app.codecov.io/gh/trailmix/utilities/branch/next\" align=\"right\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/trailmix/utilities/branch/next/graphs/tree.svg\" alt=\"codecov next\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## [CONTRIBUTE - learn how to help 🧪👉💩🙏 💯👆](CONTRIBUTE.md)\n\n## Usage\n\n### [🌈 Colors](./src/color/README.md)\n\n\u003ch3 align=\"center\"\u003eColor string output easily with ANSI.\u003c/h3\u003e\n\n#### **Simple**\n\n```typescript\n// import fns and style helpers\nimport {\n  messageByFn,\n  messageByFnSpread,\n  messageByString,\n  messageByStringSpread,\n  random,\n  randomOpts,\n  randomStyleFn,\n  randomStyleString,\n  styles as s,\n} from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\n\n// random StyleFn Message Functions\nconsole.log(messageByFn(\"hello\", [s.cyan, s.bgRed])); // cyan text, red BG\nconsole.log(messageByFnSpread(\"test\", s.yellow, s.bgRed)); // yellow text, red BG\n// random Style Functions\nconsole.log(randomStyleFn(\"emphasis\")); // get a random emphasis typeof StyleFn {(str:string) =\u003e string}\nconsole.log(randomStyleString(\"color\")); // get a random color string typeof Style\n// random StyleString Message Functions\nconsole.log(messageByString(\"hello\", [randomStyleString(\"color\")])); // random text color\nconsole.log(messageByStringSpread(\"hello\", randomStyleString(\"bgColor\"))); // random background color\nconsole.log(messageByFnSpread(\"hello\", s[randomStyleString(\"emphasis\")])); // call style list with random style fn\nconsole.log(random(\"hello\")); // get random style on this string (50% chance of color/bg/emphasis)\nconsole.log(random(\"hello\", { color: true })); // get random color on this string\nconsole.log(random(\"hello\", randomOpts({ color: true }))); // get random color 100%, (50% chance for others)\n```\n\n\u003ca href=\"https://deno.land/x/trailmix/src/color\"\u003e\n  \u003cimg\n    src=\"https://trailmix-images.s3.amazonaws.com/utilities/colorS.gif\"\n    alt=\"goofus_colors goofus colors trailmix deno typescript\"\n  /\u003e\n\u003c/a\u003e\n\n#### **Complex**\n\n```typescript\n// import the class and style helpers\nimport {\n  Color as C,\n  stylesMap as sM,\n} from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\nimport type { Style } from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\n\n// you can use defined or anon functions\nfunction test(str: string) {\n  return str + \"defined function\";\n}\nconst byFnConfAlpha = [\n  C.randomStyleFn(), // randoms return a random text color by default\n  test,\n  C.randomStyleFn(\"bgColor\"),\n  (str: string) =\u003e {\n    // anon functions can be used\n    return str + C.random(\"anon function\", { emphasis: true });\n  },\n];\nconst rConf = { color: true, bgColor: true, emphasis: false };\nconst byFnConfBeta = [\n  sM.color.brightBlue, // stylesMap is ordered by color|bgColor|emphasis\n  (str: string) =\u003e {\n    return str + \"anon function\";\n  },\n  sM.color.yellow,\n  sM.bgColor.bgBrightCyan,\n  test,\n  sM.emphasis.strikethrough,\n  C.styleMap.dim, // styles is all in a map\n  sM.bgColor.bgBrightYellow,\n  test,\n  (str: string) =\u003e {\n    return \"anon function\" + str;\n  },\n  C.styleMap.bgBrightYellow,\n];\nconst _sList: Style[] = [\"cyan\", \"bgMagenta\", \"underline\"]; // list of Style strings\nconsole.log(C.messageByFnSpread(\"test\", ...byFnConfAlpha)); // spread StyleFns\nconsole.log(C.messageByFnSpread(\"test\", ...byFnConfBeta));\nconsole.log(\n  C.messageByString(\"this is not a spring spread\", [\n    \"cyan\",\n    \"bgMagenta\",\n    \"underline\",\n  ]),\n); // no spread\nconsole.log(\n  C.messageByStringSpread(\n    \"a spring spread\",\n    \"green\",\n    \"bgBlack\",\n    \"strikethrough\",\n  ),\n); // spreading Style strings\nconsole.log(\n  C.messageByStringSpread(\"a spring spread again with a var\", ..._sList),\n);\nconsole.log(C.random(\"test some string\", rConf)); // random function\n```\n\n\u003ca href=\"https://deno.land/x/trailmix/src/color\"\u003e\n  \u003cimg\n    src=\"https://trailmix-images.s3.amazonaws.com/utilities/colorC.gif\"\n    alt=\"goofus_colors goofus colors trailmix deno typescript\"\n  /\u003e\n\u003c/a\u003e\n\n### [🔋 Config](./src/config/README.md)\n\n\u003ch3 align=\"center\"\u003eIngest configuration from env variables, file, or flags.\u003c/h3\u003e\n\n#### **Simple**\n\n```typescript\nimport {\n  EnvConfig,\n  FlagConfig,\n} from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\n\nDeno.env.set(\"DEFAULT_TEST1\", \"val1\"); // set example env var in DEFAULT namespace\n// slurp up env vars\nconsole.log(EnvConfig.parseEnv()); // should have { test1: \"val1\" }\n// something more complex\nDeno.env.set(\"DEFAULT_LOG_CONSOLE_LEVEL\", \"DEBUG\"); // set log level in DEFAULT namespace\nconsole.log(EnvConfig.parseEnv()); // should have { test1: \"val1\", log: { console: { level: \"DEBUG\" } } }\n// this is good for cmd line arguments (--logConsoleLevel DEBUG)\nconsole.log(FlagConfig.parseFlags({\n  logConsoleLevel: \"DEBUG\",\n  test1: \"val1\",\n  test2: \"true\",\n  test3: [\"val1\", \"val2\"],\n  test4AB: \"false\",\n  test5TestwordTestphraseAB: \"hello\",\n})); // should have same as above\n```\n\n\u003ca href=\"https://deno.land/x/trailmix/src/config\"\u003e\n  \u003cimg\n    src=\"https://trailmix-images.s3.amazonaws.com/utilities/configS.gif\"\n    alt=\"goofus_config goofus config trailmix deno typescript\"\n  /\u003e\n\u003c/a\u003e\n\n#### **Complex**\n\n```typescript\nimport {\n  EnvConfig,\n  FileConfig,\n  FlagConfig,\n} from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\n\n// set env first is if it was there before runtime\nDeno.env.set(\"TRILOM_LOG_CONSOLE_LEVEL\", \"DEBUG\");\n// lets use our own namespace with a config file\nawait Deno.writeFile(\n  Deno.cwd() + \"/trilom.config.ts\",\n  new TextEncoder().encode(\n    'export default {log: {console: {format: \"json\"}}};',\n  ),\n);\n// slurp flags\nconst flagCfg = new FlagConfig({\n  namespace: \"TRILOM\",\n  flags: { logConsoleColor: \"false\" },\n});\n// scope env vars\nconst envCfg = new EnvConfig(flagCfg);\n// suck in file\nconst cfg = await new FileConfig(envCfg).parseFile();\n\nconsole.log(flagCfg); // will give a log config with {console: { color: false } }\nconsole.log(envCfg); // will give a log config with {console: { color: false, level: \"DEBUG\" } }\nconsole.log(cfg); // will give a log config with {console: { color: false, level: \"DEBUG\", format: \"json\" } }\n```\n\n\u003ca href=\"https://deno.land/x/trailmix/src/config\"\u003e\n  \u003cimg\n    src=\"https://trailmix-images.s3.amazonaws.com/utilities/configC.gif\"\n    alt=\"goofus_config goofus config trailmix deno typescript\"\n  /\u003e\n\u003c/a\u003e\n\n### [🪵 Log](./src/log/README.md)\n\n\u003ch3 align=\"center\"\u003emake logging grape again with color\u003c/h3\u003e\n\n#### **Simple**\n\n```typescript\nimport { Log, random as r } from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\nLog.error(\"basic britches👖\"); // in red \"[default] basic britches👖\"\n// pass any number of arguments\nLog.success(\n  \"test\",\n  { error: \"really?\" },\n  \"s\",\n  20,\n  90071992547409990071992547404545990n,\n  true,\n  null,\n  undefined,\n  Symbol(\"key\"),\n  new Error(\"test\"),\n  Log.success(\"noArgs\"),\n  Log.error(\"args\", \"failure\"),\n); // in green  \"[default] success\"\nLog.error(\"error\", \"trust me, its 👌\"); //\nLog.success(\n  \"silly \" + r(\"r\") + r(\"a\") + r(\"n\") + r(\"d\") + r(\"o\") + r(\"m\") + \" strang\",\n);\n```\n\n\u003ca href=\"https://deno.land/x/trailmix/src/log\"\u003e\n  \u003cimg\n    src=\"https://trailmix-images.s3.amazonaws.com/utilities/logS.gif\"\n    alt=\"goofus_log goofus log trailmix deno typescript\"/\u003e\n\u003c/a\u003e\n\n#### **Complex**\n\n```typescript\nimport {\n  EnvConfig,\n  FlagConfig,\n  Log,\n} from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\n\n// make a logger with flags\nconst l = await new Log(\n  \"default\",\n  new FlagConfig({\n    flags: {\n      logConsoleLevel: \"DEBUG\",\n      logConsoleFormat: \"json\",\n      logFileEnabled: true,\n      logFilePath: \".\",\n      logFileLevel: \"DEBUG\",\n      logFileFormat: \"string\",\n    },\n  }).log,\n).init();\n// now log, 5 console json messages, and 5 string file messages\nl.success(\"success\");\nl.error(\"error\");\nl.warn(\"warn\");\nl.info(\"info\");\nl.debug(\"debug\");\n\n// make a test logger with env for deDEBUG\nDeno.env.set(\"DEFAULT_LOG_CONSOLE_LEVEL\", \"DEBUG\");\nconst lNew = await new Log(\n  \"test\",\n  new EnvConfig().log,\n).init();\n// now log, 6 console string messages\nlNew.success(\"success\");\nlNew.error(\"error\");\nlNew.warn(\"warn\");\nlNew.info(\"info\");\nlNew.debug(\"debug\");\n```\n\n\u003ca href=\"https://deno.land/x/trailmix/src/log\"\u003e\n  \u003cimg\n    src=\"https://trailmix-images.s3.amazonaws.com/utilities/logC.gif\"\n    alt=\"goofus_log goofus log trailmix deno typescript\"/\u003e\n\u003c/a\u003e\n\n### [🕰 Watch](./src/watch/README.md)\n\n\u003ch3 align=\"center\"\u003eWatch and react to changes of files.\u003c/h3\u003e\n\n### [🌐 common](./src/common/README.md)\n\n\u003ch3 align=\"center\"\u003ea collection of micro-utilities\u003c/h3\u003e\n\n#### alphaBET\n\nUse color, and table to build a table of 26 rows with 26 random styled letter in\neach row.\n\n```typescript\nimport {\n  random as r,\n  resetTable,\n} from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\nimport type { Table } from \"https://deno.land/x/trailmix@1.0.5/mod.ts\";\n\nconst alpha = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\nconst tR: string[][] = [];\nfor (const a of Array(10).keys()) {\n  let m = \"\";\n  for (const _a of alpha) {\n    m += r(_a);\n  }\n  tR.push([m + \"\\n\"]);\n}\nresetTable({ table: tR as Table, maxColWidth: 100 }).render();\n```\n\n\u003ca href=\"https://deno.land/x/trailmix/src/common\"\u003e\n  \u003cimg\n    src=\"https://trailmix-images.s3.amazonaws.com/utilities/common.gif\"\n    alt=\"goofus_common goofOOF common trailmix deno typescript\"\n  /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailmix%2Futilities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrailmix%2Futilities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailmix%2Futilities/lists"}