Gathering detailed insights and metrics for @basd/formatter
Gathering detailed insights and metrics for @basd/formatter
npm install @basd/formatter
Typescript
Module System
Node Version
NPM Version
61.4
Supply Chain
80.7
Quality
72.4
Maintenance
100
Vulnerability
99.6
License
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
731
Last Day
1
Last Week
8
Last Month
59
Last Year
312
Latest Version
0.0.2
Package Id
@basd/formatter@0.0.2
Unpacked Size
25.50 kB
Size
6.42 kB
File Count
9
NPM Version
8.19.4
Node Version
16.20.0
Published on
Oct 08, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
300%
8
Compared to previous week
Last Month
73.5%
59
Compared to previous month
Last Year
-25.5%
312
Compared to previous year
1
3
A comprehensive text formatting and manipulation library written in JS. It aims to offer a simple and efficient way to format, normalize, tokenize, and filter text in various scenarios.
Install the package with:
1npm install @basd/formatter
First, import the Formatter
library.
1import Formatter from '@basd/formatter'
or
1const Formatter = require('@basd/formatter')
Or import TextFormatter
and StopWordFilter
classes like this:
1const { TextFormatter, StopWordFilter } = require('@basd/formatter')
1const formatter = new TextFormatter() 2 3console.log(formatter.normalizeSearchQuery('hello & world | earth')) 4// Output: 'HELLO AND WORLD OR EARTH' 5 6console.log(formatter.toUpperCase('hello world')) 7// Output: 'HELLO WORLD' 8 9console.log(formatter.toLowerCase('HELLO WORLD')) 10// Output: 'hello world' 11 12console.log(formatter.stripPunctuation('hello, world!')) 13// Output: 'hello world' 14 15const tokens = formatter.tokenize('This is an example.') 16console.log(tokens) 17// Output: ['this', 'is', 'an', 'example']
1const stopWordFilter = new StopWordFilter(['a', 'an', 'the']) 2console.log(stopWordFilter.filter(['this', 'is', 'a', 'test'])) 3// Output: ['this', 'is', 'test']
normalizeSearchQuery(text: string): string
stripPunctuation(text: string): string
toUpperCase(text: string): string
toLowerCase(text: string): string
splitWords(text: string): Array<string>
filterStopWords(words: Array<string>): Array<string>
normalize(text: string, upper: boolean = false): string
tokenize(text: string, filterStopWords: boolean = true): Array<string>
setStopWords(stopWords: Array<string>)
: Set a new list of stop words.filter(words: Array<string>): Array<string>
setStopWords(stopWords: Array<string>)
: Set a new list of stop words.get defaultStopWords(): Array<string>
: Get the default list of stop words.get extendedStopWords(): Array<string>
: Get an extended list of stop words. (extendedStopWords
must be imported or defined.)In order to run the test suite, simply clone the repository and install its dependencies:
1git clone https://gitlab.com/frenware/utils/formatter.git 2cd formatter 3npm install
To run the tests:
1npm test
Thank you! Please see our contributing guidelines for details.
If you find this project useful and want to help support further development, please send us some coin. We greatly appreciate any and all contributions. Thank you!
Bitcoin (BTC):
1JUb1yNFH6wjGekRUW6Dfgyg4J4h6wKKdF
Monero (XMR):
46uV2fMZT3EWkBrGUgszJCcbqFqEvqrB4bZBJwsbx7yA8e2WBakXzJSUK8aqT4GoqERzbg4oKT2SiPeCgjzVH6VpSQ5y7KQ
@basd/formatter is MIT licensed.
No vulnerabilities found.
No security vulnerabilities found.