1.2.5 • Published 5 years ago

wordlist-to-json v1.2.5

Weekly downloads
10
License
ISC
Repository
github
Last release
5 years ago

wordlist-to-json

Greenkeeper badge

Convert wordlists to JSON format

Quickly convert a list of words to a JSON object or JSON array quickly with the command line, or in a JS script.

System Requirements

  • Node v8 or higher
  • npm v5 or higher
  • An internal burning need to turn a wordlist into a JSON object or JSON array

Installation

npm install -g wordlist-to-json

Installing this module allows you to use this tool as a CLI tool:

$ wordlist-to-json --file "path/to/wordlist.txt"

Usage

CLI

Run wordlist-to-json --help for usage information.

As a module

Because fs.readFile runs asynchronously, wordlist-to-json returns a Promise.

const WordlistToJSON = require('wordlist-to-json');

WordListToJSON('path/to/list.txt').then( array => {
  console.log(array); // ['hello', 'list', 'of', 'words' ]
});

Because this module is Promise based, you can use it in an async function like this:

import WordlistToJSON from 'wordlist-to-json';

async function SuperAwesomeAsyncFunction() {
  const obj = await WordListToJSON('path/to/file.txt', { value: 2 });
  return obj; // { hello: 2, list: 2, of: 2, words: 2 }
}

Notes

This was a quick script that I created to help internationalize get-alex/alex - which is a pretty awesome project :D

Made with <3 by @MrBenJ.

1.2.5

5 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago