Coupon — discount coupons generator. Coupon is designed to be the simplest way possible to create a discount coupons for e-commerce purposes.
npm install coupon
var coupon = require("coupon");
var myCoupon = coupon("GREAT-30")
.give("30%")
.limit(10)
.person("Mr. Fetus")
.only("Banana")
.expire(new Date(2015, 0, 1));
console.log(myCoupon.json());
var coupon = require("coupon");
var myCoupon = coupon("HELLO-5").give("5%");
console.log(myCoupon.json());
{
id: 'W0YEPW913C8M279D0ECV2P5P0C11QAV1',
name: 'HELLO-5',
discount: 0.05
}
var coupon = require("coupon");
var myCoupon = coupon("HELLO-JOHN").give("20%").person("John").limit(1);
console.log(myCoupon.json());
{
id: 'K5PL08XU1GG71T9VW00Y4CEUJFVPMM2F',
name: 'HELLO-JOHN',
user: 'John',
countMax: 1,
discount: 0.2
}
Specifies amount of discount.
coupon().give(10);
or
coupon().give("10%");
You can pass "free" string
coupon().give("free").only("Delivery");
Specifies user
coupon().give("5%").person("John Smith");
Specifies how many times you can use coupon
coupon().give("5%");
Specifies expiration date of coupon
coupon().give("10%").expire(new Date(2015, 5, 15));
Specifies the service
coupon().give("5%").only("Banana");
Generate JSON object
coupon().give("5%");
npm test
Licensed under the MIT license
Copyright © 2014 Roman Timashev roman@tmshv.ru (http://roman.tmshv.ru)