This repository has been archived by the owner on Nov 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
info.json
1 lines (1 loc) · 6.18 KB
/
info.json
1
{"name":"simple-card","version":"2.2.0","description":"A simple plug and play credit card validation library that uses the luhn algorithm","docs":[{"since":"v2.0.0","category":"Function","title":"cvn","desc":"Validates that the string cvn passed in is a valid cvn number","examples":["cvn('333') // => { isValid: true, cvnType: 'norm' }\rcvn(333) // => { isValid: true, cvnType: 'norm' }\rcvn('4444') // => { isValid: true, cvnType: 'amex' }\rcvn(4444) // => { isValid: true, cvnType: 'amex' }\rcvn('55555') // => { isValid: false, cvnType: 'Invalid CVN Code' }\rcvn(55555) // => { isValid: false, cvnType: 'Invalid CVN Code' }"],"returns":[{"type":{"names":["Object"]},"description":"An object containing a isValid boolean and some info"}],"params":[{"type":{"names":["String","Number"]},"description":"The string cvn we want to validate","name":"cvnCode"}],"syntax":"cvn(cvnCode)","usage":{"commonjs":{"title":"CommonJs","code":"const cvn = require('simple-card/cvn')"},"standard":{"title":"Standard","code":"import cvn from 'simple-card/cvn'"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/simple-card@2.2.0/cvn.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/simple-card/cvn/index.js\"></script>"}}},{"since":"v2.0.0","category":"Function","title":"expired","desc":"Validates that the string date passed in is indeed a valid date and not an old one","examples":["// Assuming \"currDate\" is a variable that holds the current date in a XX/XX format\rexpired(currDate) // => { isValid: true, isExpired: false }\rexpired('01/18') // => { isValid: false, isExpired: true }"],"returns":[{"type":{"names":["Object"]},"description":"An object containing a isValid boolean and some info"}],"params":[{"type":{"names":["String"]},"description":"The string date we want to validate","name":"date"}],"syntax":"expired(date)","usage":{"commonjs":{"title":"CommonJs","code":"const expired = require('simple-card/expired')"},"standard":{"title":"Standard","code":"import expired from 'simple-card/expired'"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/simple-card@2.2.0/expired.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/simple-card/expired/index.js\"></script>"}}},{"since":"v2.0.0","category":"Function","title":"matches","desc":"Validates that the card type (generated from the card number) matches and is valid with the cvn provided","examples":["matches('333', '4111111111111111') // => { isValid: true, match: 'card type matches cvn' }\rmatches(333, 4111111111111111) // => { isValid: true, match: 'card type matches cvn' }\r\r// Assuming that amexCardNumber is defined as an American Express Credit Card Number\rmatches('4444', amexCardNumber) // => { isValid: true, match: 'card type matches cvn' }\rmatches(4444, amexCardNumber) // => { isValid: true, match: 'card type matches cvn' }\r\rmatches('4444', '4111111111111111') // => { isValid: false, match: 'cvn does not match card type' }\rmatches(4444, 4111111111111111) // => { isValid: false, match: 'cvn does not match card type' }"],"returns":[{"type":{"names":["Boolean"]},"description":"A boolean based on if the match is valid or not"}],"params":[{"type":{"names":["String","Number"]},"description":"The string cvn we want to validate","name":"cvn"},{"type":{"names":["String","Number"]},"description":"The string card we want to validate with","name":"card"}],"syntax":"matches(cvn, card)","usage":{"commonjs":{"title":"CommonJs","code":"const matches = require('simple-card/matches')"},"standard":{"title":"Standard","code":"import matches from 'simple-card/matches'"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/simple-card@2.2.0/matches.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/simple-card/matches/index.js\"></script>"}}},{"since":"v2.0.0","category":"Function","title":"number","desc":"Validates that the card number is an actual valid number with a luhn algorithm. As well as finds the cards type","examples":["number('4111111111111111') // => { isValid: true, cardType: 'visa' }\rnumber(4111111111111111) // => { isValid: true, cardType: 'visa' }\rnumber('33222123') // => { isValid: false, cardType: 'Invalid Card Number' }\rnumber(33222123) // => { isValid: false, cardType: 'Invalid Card Number' }"],"returns":[{"type":{"names":["Object"]},"description":"An object containing a isValid boolean and some info"}],"params":[{"type":{"names":["String","Number"]},"description":"The string card we want to validate","name":"card"}],"syntax":"number(card)","usage":{"commonjs":{"title":"CommonJs","code":"const number = require('simple-card/number')"},"standard":{"title":"Standard","code":"import number from 'simple-card/number'"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/simple-card@2.2.0/number.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/simple-card/number/index.js\"></script>"}}},{"since":"v2.0.0","category":"Function","title":"validate","desc":"Validates a credit card object comparing and validating each piece of data on the card passed in","examples":["const test = validate({\r\n number: '4111111111111111',\r\n cvn: '333',\r\n date: '09/20'\r\n }); // => { isValid: true, cardType: 'visa', cvnType: 'norm', expired: false }\r\n\r\n validate({\r\n number: '4111111111111111',\r\n cvn: '3432',\r\n date: currentDate // A simple var which is a string for the current date\r\n }); // => { isValid: false, cardType: 'visa', cvnType: 'norm', expired: 'Not Expired', info: 'CVN does not match the found card type' }"],"returns":[{"type":{"names":["Object"]},"description":"Returns an object of information about the test and whether or not it passed"}],"params":[{"type":{"names":["Object"]},"description":"The card Object that we wish to be validated","name":"card"}],"syntax":"validate(card)","usage":{"commonjs":{"title":"CommonJs","code":"const validate = require('simple-card/validate')"},"standard":{"title":"Standard","code":"import validate from 'simple-card/validate'"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/simple-card@2.2.0/validate.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/simple-card/validate/index.js\"></script>"}}}]}