An open API service indexing awesome lists of open source software.

https://github.com/thang2162/wordfrequency

A simple script to count the frequency of words in a string.
https://github.com/thang2162/wordfrequency

Last synced: 2 months ago
JSON representation

A simple script to count the frequency of words in a string.

Awesome Lists containing this project

README

        

# WordFrequency
A simple script to count the frequency of words in a string.


# Installation
```
npm install @thang2162/wordfrequency --save
```
or
```
yarn add @thang2162/wordfrequency
```
# Arguments
1. String (required) - String to be processed.
2. SortBy (optional) - 'desc' for descending or 'asc' ascending.
Example:

WordCounter(String, SortBy).then(res => {
alert(JSON.stringify(res));
});

This returns a sorted object array.

# Usage
```javascript
import {WordFrequency} from '@thang2162/wordfrequency'
const str = "With great power there must also come -- great responsibility.";

WordFrequency(str, 'asc').then(res => {
alert(JSON.stringify(res));
});
```
# CDN
```html

const str = "With great power there must also come -- great responsibility.";

WordFrequency(str, 'asc').then(res => {
alert(JSON.stringify(res));
});

```