stringendo
v1.0.7
Published
JavaScript string inspector.
Downloads
19
Maintainers
Readme
Stringendo
JavaScript string inspector.
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]