Natural Preference for Minification

npm

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

hashbrown

0.1.0 • Public • Published

Hashbrown.js npm Version Build Status Coverage Status

Extract tags inlined in running text.

Usage

Hashbrown is a means of embedding meta data within running text. It is similar to the concept of the hashtag, only that the post-processed text is syntactically correct. This is because the #( and ) markup used to demarcate a tag is removed from the text.

var str = '#( Lorem ipsum! ) Dolor #( sit ) amet!';
 
hashbrown(str);
/* =>
 * {
 *   text: 'Lorem ipsum! Dolor sit amet!',
 *   tags: ['lorem-ipsum', 'sit']
 * }
 */

A tag is converted to kebab-case as follows:

  1. Discard any character that isn’t alphanumeric, whitespace, a dash, or an underscore.
  2. Replace whitespace and underscore characters with a dash.

API

hashbrown(str)

Parses the given str, and returns an object containing text (which is the str stripped of the #( and ) markup), and an array of tags.

Installation

Install via npm:

$ npm i --save hashbrown

License

MIT license

install

npm i hashbrown

Downloadsweekly downloads

9

version

0.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability