All Projects → rodrigoalvesvieira → Microtext.js

rodrigoalvesvieira / Microtext.js

Licence: other
A micro JavaScript utility for processing text.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Microtext.js

Goat
POSIX-compliant shell movement boosting hack for real ninjas (aka `cd x` and `cd ...`)
Stars: ✭ 27 (-54.24%)
Mutual labels:  utility
Remixbot
A multifunctional Discord bot in development that allows you to easily control your discord server.
Stars: ✭ 39 (-33.9%)
Mutual labels:  utility
Uhubctl
uhubctl - USB hub per-port power control
Stars: ✭ 1,036 (+1655.93%)
Mutual labels:  utility
Pinku
A Pinboard-to-buku importation utility
Stars: ✭ 30 (-49.15%)
Mutual labels:  utility
Chmap
The Windows `charmap` utility for Linux
Stars: ✭ 39 (-33.9%)
Mutual labels:  utility
Qrcp
⚡ Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.
Stars: ✭ 8,216 (+13825.42%)
Mutual labels:  utility
Python Common Cache
This project is a cache component based on the memory and it is lightweight, simple and customizable. 🐍 😃
Stars: ✭ 21 (-64.41%)
Mutual labels:  utility
Yippy
macOS open source clipboard manager
Stars: ✭ 57 (-3.39%)
Mutual labels:  utility
Flutter mono kit
A collection of convenient widgets and utils made by mono.
Stars: ✭ 39 (-33.9%)
Mutual labels:  utility
Jj
JSON Stream Editor (command line utility)
Stars: ✭ 1,033 (+1650.85%)
Mutual labels:  utility
Unidump
hexdump(1) for Unicode data
Stars: ✭ 31 (-47.46%)
Mutual labels:  utility
Shifty
☀️ A macOS menu bar app that gives you more control over Night Shift.
Stars: ✭ 990 (+1577.97%)
Mutual labels:  utility
Ngx Infinite Scroll
Infinite Scroll Directive for Angular
Stars: ✭ 1,024 (+1635.59%)
Mutual labels:  utility
Invite Contributors
automatically invite authors of merged pull requests to your organization
Stars: ✭ 30 (-49.15%)
Mutual labels:  utility
C Utils
Tiny, modular, drop-in, library of some most commonly used utility methods for C (embedded) applications. Intended to be used as a git-submodule inside your projects to kickstart development. See https://c-utils.gotomain.io for more details.
Stars: ✭ 47 (-20.34%)
Mutual labels:  utility
Text Minimap
Generate text minimap/preview using Braille Patterns
Stars: ✭ 21 (-64.41%)
Mutual labels:  utility
Wtf
Whitespace Total Fixer
Stars: ✭ 40 (-32.2%)
Mutual labels:  utility
Cameo
CMIO DAL plugin explorer
Stars: ✭ 59 (+0%)
Mutual labels:  utility
Is Empty
Check whether a value is empty.
Stars: ✭ 47 (-20.34%)
Mutual labels:  utility
Potato Library
Easy to use Utility library for Android
Stars: ✭ 45 (-23.73%)
Mutual labels:  utility

microtext.js

A micro JavaScript utility for processing text.

UPDATE: Microtext.js is now available as an Angular.js module https://github.com/rodrigoalvesvieira/angular-microtext

NOTE: the purpose of this project is to provide simple and useful text processing functions to the web developer's toolset. Please read the Contributions section for more information about this.

Build Status

Usage

Microtext object functions:

Microtext.breakSentence("Gaal Dornick"); // ["Gaal", "Dornick"]

Microtext.truncate("Lewis Pirenne", 10) // "Lewis Pire..."

Microtext.abbrevName("Hari Seldon"); // "Hari S."

Microtext.firstName("Lors Avakim"); // "Lors"

Microtext.lastName("Salvor Hardin"); // "Hardin"

Microtext.getInitials("Bor Alurin"); // "B. A"

Microtext.capitalize("foundation"); // "Foundation"

Microtext.simpleFormat("Sef Sermak"); // returns "<p>Sef Sermak</p>"

Microtext.simpleFormat("Sef Sermak", { className: "character" });
// returns "<p class='character'>Sef Sermak</p>"

Microtext.excerpt("Who is John Galt?", "John"); // returns "...John Galt?..."

Microtext.hideEmail("[email protected]"); // "[email protected]"

Microtext.parameterize("It was childish to feel disappointed");
// "it-was-childish-to-feel-disappointed"

Microtext.hideBadWord("Bitch!"); // "B!#&&"

Microtext.ordinal(11243); // "11243rd"

Refer to the Wiki for more information.

String instance methods

"Anselm haut Rodric".nameAt(2) // "Rodric"

"Anselm haut Rodric".nameAt(3) // undefined

Handlebars.js

Microtext.js functions can also be used as plain Handlebars.js helpers:

{{ getInitials "Isaac Newton" }}

{{ abbrevName "Albert Einstein" }}

Checking for code quality

Microtext.js was written to be 100% passed by JSLint with no flags. So you can try:

$ jslint microtext.js

Also, you can run JSHint on the project via Grunt:

$ cd microtext.js

$ grunt

Build

Generate the minified version of Microtext, a.k.a microtext.min.js

$ uglifyjs src/microtext.js --screw-ie8 > dist/microtext.min.js

Author

  • Rodrigo Alves - rodrigovieira1994 [at] gmail [dot] com

Contributions

You can contribute to Microtext.js by adding new text processing/helper functions or by improving the existing ones as well as fixing eventual bugs. In any case, your contribution is totally welcome.

Refer to this blog post if you don't know how to proceed before sending a Pull Request.

Licence

Released under the MIT License. See LICENSE.txt for details.

Copyright (c) 2012-2014 Rodrigo Alves

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].