Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

code-generator-js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-generator-js

CLI for generating codes

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

code-generator-js

JavaScript implementation of code-generator

Travis npm version npm downloads npm license

Installation

npm install -g code-generator-js

Tip

This implementation is very slow compared to the original package written in Go. The only reason for building this package was to compare performance. When generating 100.000 codes Go performs 530 % faster than this implementation.

Options

-h, --help         output usage information
-v --version       output the version number
-p, --pattern <p>  Code pattern l for letter, n for number and - for dash
-l, --length <l>   Number of codes to generate
-c, --case <c>     Number of codes to generate [upper] [lower]

Usage

Generate a single code. (codes.txt is saved in current directory)

code
//=> Generated: 1/1 codes
//=> Done. Codes saved to codes.txt
//=> Generation took: 14.118ms

Generate codes using a pattern (l for letters. n for number. - or any character for dash)

code --pattern nnnn-llll
//=> Generated: 1/1 codes
//=> Done. Codes saved to codes.txt
//=> Generation took: 14.118ms

Generate a thousand codes with nnnn-llll pattern

code --pattern nnnn-llll --length 1000
//=> Generated: 1000/1000 codes
//=> Done. Codes saved to codes.txt
//=> Generation took: 55.938ms

Generate a thousand uppercase codes with nnnn-llll pattern

code --pattern nnnn-llll --length 1000 --case upper
//=> Generated: 1000/1000 codes
//=> Done. Codes saved to codes.txt
//=> Generation took: 55.938ms
  • code-generator - Go implementation

License

MIT © Daniel Eckermann

FAQs

Package last updated on 19 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc