Giter VIP home page Giter VIP logo

node-word-generator's Introduction

node-word-generator

Features:

* Random generate a word or many words which can be used as passwords, keys etc.
* You can specify your letters to  generate words or use default letters(A-Z,a-z,0-9).
* For each word callback your function to do something, such as to guess or crack passwords ... 

Install:

 npm install word-generator

Example:

> var WG = require('word-generator');

> var wg = new WG.WordsGenerator();
> wg
{ width: 10,
  letters: 
      [
            '0','1','2','3','4','5','6','7','8','9',
            'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
	    'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
      ]
}

> wg.generateWord()
'j4AWKwVdni'
> wg.generateWord()
'xi5UYW8kLj'


> wg.getMaxCountCanBeGenerate()
839299365868340200

> wg.generateWordsToObject(10); //each key in Object is unique
{ SCXI05S3xk: true,
  Aiy71JW6PG: true,
  td0LUsrAJ6: true,
  yi8l3M03UV: true,
  NRLwdPlpJ3: true,
  W8XQCmicgO: true,
  ZY3ucczf6u: true,
  BHYox5GAi2: true,
  RsUFNStamq: true,
  aSnkKqYCOY: true }

> wg = new WG.WordsGenerator(2,'abc');
> wg
{ width: 2, letters: [ 'a', 'b', 'c' ] }

For each word callback:
> var allWords = wg.generateAllWordsToObject(function eachWordCallback(word,index){console.log(index,word)});
1 'ba'
2 'bb'
3 'cc'
4 'ab'
5 'ac'
6 'bc'
7 'aa'
8 'ca'
9 'cb'
> allWords
{ ba: true,
  bb: true,
  cc: true,
  ab: true,
  ac: true,
  bc: true,
  aa: true,
  ca: true,
  cb: true }

node-word-generator's People

Contributors

andrewgoal avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jank3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.