Skip to content

A quick CLI tool and node_module that takes a list of words and turns it into a JSON Array or JSON Object

Notifications You must be signed in to change notification settings

MrBenJ/wordlist-to-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A quick CLI tool and node_module that takes a list of words and turns it into a JSON Array or JSON Object

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •