1.0.7 ā€¢ Published 5 years ago

formel v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

šŸ”¢šŸ˜Š Formel

āš”ļø Simply and lightweight Js package for the browser and for Node.js that provides extra String methods.

npm.io 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

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago