A javascript library for formatting and manipulating text.
var sample = textural('sampleText').format('snake');
// 'sample_text'
<script src="textural.min.js"> </script>
npm install textural
var textural = require('textural');
Text can be formatted to any known format such as camelCase, snake_case, slug-case, human case.
Note: you can use upper, lower and capitalize prefix for any kind of format, e.g uppersnake will produce: SNAKE_CASE
Description | Format | Result |
---|---|---|
convert to camelCase | camel | exampleText |
convert to snake_case | snake | example_text |
convert to slug-case | slug | example-text |
convert to normal text | human | example text |
truncate letters (change number after t according to your needs) | t3 | exa |
Format | Result |
---|---|
uppersnake | EXAMPLE_TEXT |
lowersnake | example_text |
capitalizesnake | Example_Text |
Note: null handler should be set always at the end of format string, you can put any text you like inside parentheses and also it can be added to any type of format
Format | Result |
---|---|
(-) | - |
lowersnake(No value) | No value |
textural.js was inspired by and heavily borrowed from numeral.js