npm

Need private packages and team management tools?Check out npm Orgs. »

formel

1.0.7 • Public • Published

🔢😊 Formel

⚡️ Simply and lightweight Js package for the browser and for Node.js that provides extra String methods.

badgen badgen

Usage

import formel from "formel";
or;
var formel = require("formel");

Or include it via jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/formel@1.0.7/build/index.min.js"></script>

Example

formel(string) // constructor
.capitalize() // method
.val // get value
 
// chaining methods
formel("  hello   world  ")
.compact()
.capitalize()
.val // Hello world

Methods & Examples

- rmTags()

remove all html tags from a string

formel("<script>hello world</script> fine<br />").rmTags().val // hello world fine

- rmSpaces()

remove all spaces from a string

formel("  hello   world  ").rmSpaces().val // helloworld

- rmFirst(number)

remove first n characters from a string

formel("hello").rmFirst(2).val // llo

- rmLast(number)

remove last n characters from a string

formel("sunday").rmLast(2).val // sund

- compact()

remove all extra spaces from a string

formel("  hello   world  ").compact().val // hello world

- capitalize()

formel("hello world").capitalize().val // Hello world

- revstr()

reverse a string

formel("welcome").revstr().val // emoclew

- splitInto([spread], [seprator])

formel("12456789").splitInto().val // 123 456 789
formel("hello").splitInto(2, "-").val // he-ll-o
formel("welcome 2019").splitInto(4).val // we lc om e  20 19

Notes

  • Works both in Node.js and in the browser.
  • All pull requests are welcome, feel free.

License

MIT

install

npm i formel

Downloadsweekly downloads

12

version

1.0.7

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability