stringendo
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

Stringendo

JavaScript string inspector.

Buy Me A Coffee Follow New Releases

NPM Version NPM Downloads GitHub Stars TypeScript Typings Travis CI LGTM


If you use this project don't forget to give a ⭐ star ⭐ to it on GitHub!


Usage

Functions

  • stringendo()
  • textCharCount()
  • textHasEmoji()
  • textHasNonASCII()
  • textIsMultiline()
  • textIsNormalized()
  • textIsTrimmed()
  • textLength()
  • textLineCount()
  • textListChars()
  • textListCodes()
  • textToURI()
  • textToURL()

Importing

CommonJS import.

const { stringendo } = require("stringendo");

ECMAScript Module.

import { stringendo } from "stringendo";

AMD, UMD, browser script tag.

<script src="https://unpkg.com/stringendo"></script>

CDN (unpkg https://unpkg.com/)

<script src="https://unpkg.com/stringendo" type="module"></script>

Deno (Pika https://pika.dev/)

import { stringendo } from "https://cdn.pika.dev/stringendo";

Examples

import { stringendo } from "stringendo";
 
const text = " good\n+$#\n日programmør 😊 ";
const consolePrint = true;
const inspectionAsJSON = stringendo(text, consolePrint);
{
  "flags": {
    "hasEmoji": true,
    "hasNonASCII": true,
    "isLowerCased": true,
    "isMultiline": true,
    "isNormalized": true,
    "isTrimmed": false,
    "isUpperCased": false,
    "isUrlFriendly": false
  },
  "information": {
    "characters": 24,
    "length": 25,
    "lines": 3
  },
  "list": {
    "chars": [
      " ", "g", "o", "o", "d", "\n", "+", "$", "#", "\n", "", "p",
      "r", "o", "g", "r", "a", "m", "m", "ø", "r", " ", "😊", " "
    ],
    "codes": [
      32, 103, 111, 111, 100, 10, 43, 36, 35, 10, 26085, 112,
      114, 111, 103, 114, 97, 109, 109, 248, 114, 32, 55357, 32
    ]
  },
  "text": {
    "json": "\" good\\n+$#\\n日programmør 😊 \"",
    "lower": " good\n+$#\n日programmør 😊 ",
    "normalized": " good\n+$#\n日programmør 😊 ",
    "string": " good\n+$#\n日programmør 😊 ",
    "upper": " GOOD\n+$#\n日PROGRAMMØR 😊 "
  },
  "urls": {
    "uri": "%20good%0A+$#%0A%E6%97%A5programm%C3%B8r%20%F0%9F%98%8A%20",
    "url": "%20good%0A%2B%24%23%0A%E6%97%A5programm%C3%B8r%20%F0%9F%98%8A%20"
  }
}
String inspection:
  Texts:
    ┌────────────┬────────────────────────────────────┐
    │  (index)   │               Values               │
    ├────────────┼────────────────────────────────────┤
    │    json    │ '" good\\n+$#\\n日programmør 😊 "' │
    │   lower    │   ' good\n+$#\n日programmør 😊 '   │
    │ normalized │   ' good\n+$#\n日programmør 😊 '   │
    │   string   │   ' good\n+$#\n日programmør 😊 '   │
    │   upper    │   ' GOOD\n+$#\n日PROGRAMMØR 😊 '   │
    └────────────┴────────────────────────────────────┘
  Information:
    ┌────────────┬────────┐
    │  (index)   │ Values │
    ├────────────┼────────┤
    │ characters │   24   │
    │   length   │   25   │
    │   lines    │   3    │
    └────────────┴────────┘
  Flags:
    ┌───────────────┬────────┐
    │    (index)    │ Values │
    ├───────────────┼────────┤
    │   hasEmoji    │  true  │
    │  hasNonASCII  │  true  │
    │ isLowerCased  │  true  │
    │  isMultiline  │  true  │
    │ isNormalized  │  true  │
    │   isTrimmed   │ false  │
    │ isUpperCased  │ false  │
    │ isUrlFriendly │ false  │
    └───────────────┴────────┘
  URI:
    %20good%0A+$#%0A%E6%97%A5programm%C3%B8r%20%F0%9F%98%8A%20
  URL:
    %20good%0A%2B%24%23%0A%E6%97%A5programm%C3%B8r%20%F0%9F%98%8A%20
  Characters:
    [" ","g","o","o","d","\n","+","$","#","\n","","p","r","o","g","r","a","m","m","ø","r"," ","😊"," "]
  Character codes:
    [32,103,111,111,100,10,43,36,35,10,26085,112,114,111,103,114,97,109,109,248,114,32,55357,32]

See also

My other projects

Package Sidebar

Install

npm i stringendo

Weekly Downloads

2

Version

1.0.7

License

MIT

Unpacked Size

56.9 kB

Total Files

10

Last publish

Collaborators

  • r37r0m0d3l