Skip to content

Repository files navigation

Textshift

Zero-dependency text transformation and JSON formatting for any runtime

NodeDenoBunCDN

Module type: Deno/ESMnpm versionJSRLicense

Features

  • Text transforms - Case conversions, normalization, reversal, and sentence formatting.
  • JSON formatting - Minify, beautify, and recursive key/value sorting.
  • Runtime agnostic - Works in Deno, Node.js, Bun, and browsers.

Installation

Note

Prerequisites: For Deno (install from deno.com). For npm use Node.js (e.g. nodejs.org).

Deno (JSR):

deno add jsr:@neabyte/textshift

npm:

npm install @neabyte/textshift

CDN (jsDelivr/unpkg/esm.sh):

<scripttype="module">import{TextTransform,JsonFormatter}from'https://cdn.jsdelivr.net/npm/@neabyte/textshift/dist/index.mjs'</script>

Or via esm.sh:

<scripttype="module">import{TextTransform,JsonFormatter}from'https://esm.sh/@neabyte/textshift'</script>

Or via importmap:

<scripttype="importmap">{"imports": {"@neabyte/textshift": "https://cdn.jsdelivr.net/npm/@neabyte/textshift/dist/index.mjs"}}</script><scripttype="module">import{TextTransform,JsonFormatter}from'@neabyte/textshift'</script>

Read docs/README.md for full documentation.

Quick Start

import{TextTransform,JsonFormatter}from'@neabyte/textshift'constresult=TextTransform.capitalizedCase('hello world')console.log(result.data)// 'Hello World'constjson=JsonFormatter.beautify('{"b":2,"a":1}')console.log(json.data)// {// "b": 2,// "a": 1// }

Build

npm build (bundles to dist/):

npm run build

Testing

Type check - format, lint, and type-check:

deno task check

Unit tests - format/lint tests and run all tests:

deno task test
  • Tests live under tests/ (text transform and JSON formatter tests).
  • The test task uses --allow-read, --allow-write, and --allow-env.

License

This project is licensed under the MIT license. See the LICENSE file for details.

Contributors

Languages