JSPM

hashtagit

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q25646F
  • License MIT

Creates a formatted hashtag or @mention in the default PascalCase, or optional upper/lowercases from a given string

Package Exports

  • hashtagit

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hashtagit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Hashtagit

Easy way to create hashtags or @mentions from any given text. Best use is from copy and pasted text that can be easily turned into the given hashtag or @mention configurations.

Installing

npm install --save hashtagit

Usage

The default takes a string as the first parameter and returns a Pascal cased hashtag.

const hashtagit = require('hashtagit');

console.log(hashtagit('...this/is some random text from a..., random passage...')());
// #ThisIsSomeRandomTextFromARandomPassage

Hashtagit takes in a total of 4 parameters, with the string being the only required:

hashtagit(string, multipleHashtags)(format, tagType);

Use cases for parameters:

Each word in the string as formatted hashtag marking multipleHashtags as true.

const string = '...this/is some random text from a..., random passage...';

hashtagit(string, true)();
// #This#Is#Some#Random#Text#From#A#Random#Passage

Make it all caps or lowercase by changing the format parameter to 'low' or 'caps'.

const string = '...this/is some random text from a..., random passage...';

hashtagit(string)('low');
// #thisissomerandomtextfromarandompassage

hashtagit(string)('caps');
// #THISISSOMERANDOMTEXTFROMARANDOMPASSAGE

Create @mentions the same way by changing the tagType parameter to '@'. Be sure to make the format parameter null if using the default casing.

const string = '...this/is some random text from a..., random passage...';

hashtagit(string)(null, '@');
// @ThisIsSomeRandomTextFromARandomPassage

hashtagit(string, true)(null, '@');
// @This@Is@Some@Random@Text@From@A@Random@Passage

License

This project is licensed under the MIT License