Skip to content

Commit

Permalink
Merge pull request #53 from yusufshakeel/hybrid-codebase
Browse files Browse the repository at this point in the history
v0.10.0
  • Loading branch information
yusufshakeel authored Nov 8, 2022
2 parents 472775d + bdcab71 commit 6cf5857
Show file tree
Hide file tree
Showing 70 changed files with 8,677 additions and 11,173 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/coverage/**
**/docs/**
**/node_modules/**
**/lib/**
**/node_modules/**
40 changes: 23 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:node/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"plugin:@typescript-eslint/recommended",
"prettier"
],
"settings": {
"node": {
"tryExtensions": [
".js",
".json",
".node",
".ts",
".d.ts"
]
}
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"strict": [
"error",
"global"
],
"no-console": [
"error",
{
"allow": [
"time",
"timeEnd",
"error",
"info"
]
}
"error"
],
"new-cap": [
"off"
Expand Down Expand Up @@ -139,4 +145,4 @@
"always"
]
}
}
}
116 changes: 112 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,113 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
.idea/
docs/
coverage/
output/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# ide
.idea

# macOS
.DS_Store

# generated file
lib/
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
}
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fileignoreconfig:
- filename: package-lock.json
checksum: 2c92413b51f88c6331e9393b3b3f6a72cdfba28770b70ce2a6bf1f5dbb41dbdb
checksum: d9e2c2c48baa20ae97483392768e75bfefcf2bf5ac6f4b451a314b3c1d40b035
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 10
- 12
install: npm install
cache:
directories:
Expand Down
87 changes: 49 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
# couponjs

This is a simple coupon creation project using NodeJS.
Generate coupons.

[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/yusufshakeel/couponjs)
[![npm version](https://img.shields.io/badge/npm-0.9.4-blue.svg)](https://www.npmjs.com/package/couponjs)
[![npm version](https://img.shields.io/badge/npm-0.10.0-blue.svg)](https://www.npmjs.com/package/couponjs)
[![npm Downloads](https://img.shields.io/npm/dm/couponjs.svg)](https://www.npmjs.com/package/couponjs)

![CouponJS](./resource/couponjs-500x150.png)

# Getting Started

Add this to your project using npm.
## Use case

```
> npm i couponjs
```
Import. Configure. Generate.

Next, require `couponjs`.
This is a simple project to generate coupons. Lots of coupons.

```javascript
const CouponJS = require('couponjs');
```
Import the package, configure (this is optional), generate (1 or more coupons) and then use the coupons however
you like (save in database, etc).

## Table of Contents

* [Getting Started](#getting-started)
* [Generate coupon](#generate-coupon)
* [Coupon engine configuration](#coupon-engine-configuration)
* [Verbose](#verbose)
* [Log Performance](#log-performance)
* [Maximum number of coupons to generate](#maximum-number-of-coupons-to-generate)
* [Generate coupon](#generate-coupon)
* [Configuration to generate coupons](#configuration-to-generate-coupons)
* [Coupon of length N](#coupon-of-length-n)
* [Coupon with prefix](#coupon-with-prefix)
Expand All @@ -49,10 +44,46 @@ const CouponJS = require('couponjs');
* [Possible number of coupons](#possible-number-of-coupons)
* [Storage size](#storage-size)
* [Performance](#performance)
* [Older version](#older-version)
* [License](#license)
* [Back this project](#back-this-project)
* [Donate](#donate)

# Getting Started

#### Install

```
npm i couponjs
```

#### Require

```js
// ESM
import CouponJS from 'couponjs';

// CommonJs
const { CouponJS } = require('couponjs');
```

## Generate coupon

Create an object.

```javascript
const coupon = new CouponJS();
```

Now, call the `generate` method.

```javascript
const myCoupon = coupon.generate();
```

The above code will produce coupon like `ASDFGH`.

By default, `generate` will return coupon code of length 6 using uppercase alphabet.

## Coupon engine configuration

We can configure the CouponJS engine to get reponse in a different format.
Expand Down Expand Up @@ -185,24 +216,6 @@ const coupon = new CouponJS({
});
```

## Generate coupon

Create an object.

```javascript
const coupon = new CouponJS();
```

Now, call the `generate` method.

```javascript
const myCoupon = coupon.generate();
```

The above code will produce coupon like `ASDFGH`.

By default, `generate` will return coupon code of length 6 using uppercase alphabet.

## Configuration to generate coupons

We can pass different options to configure the engine to generate coupons as per our settings.
Expand Down Expand Up @@ -675,8 +688,6 @@ Assumption:
|16 |100000000 |1600.000 |1.600000 |
|16 |1000000000 |16000.000 |16.000000 |



## Performance

To check performance run the following command in the terminal.
Expand All @@ -687,16 +698,16 @@ To check performance run the following command in the terminal.

Performance will be recorded in `output/PERFORMANCE.md` file.

### Older version

[CommonJS version - check v0.9.4](https://github.com/yusufshakeel/couponjs/tree/v0.9.4)

## License

It's free :smiley:

[MIT License](https://github.com/yusufshakeel/couponjs/blob/master/LICENSE) Copyright (c) 2020 Yusuf Shakeel

### Back this project

If you find this project useful and interesting then feel free to support it on [Patreon](https://www.patreon.com/yusufshakeel).

### Donate

Feeling generous :smiley: [Donate via PayPal](https://www.paypal.me/yusufshakeel)
23 changes: 0 additions & 23 deletions app/character-set-builder.js

This file was deleted.

Loading

0 comments on commit 6cf5857

Please sign in to comment.