This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pluralize = require('pluralize') | |
function modelTSConstructor() { | |
'use strict' | |
const fs = require('fs') | |
const args = require('yargs').argv | |
let name = args.name | |
let date = new Date() | |
let dateStamp = | |
date | |
.toISOString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cardnumber = 4012888888881881 | |
def validlen?(arr) | |
#checks for card length of 13, 15, or 16 | |
arr.length == 13 || arr.length == 15 || arr.length == 16 | |
end | |
def arr_split(card_array) | |
#recieves array and select even or odd values and creates seperate arrays | |
select_odd_values = card_array.values_at(* card_array.each_index.select {|i| i.odd?}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
// Declare and initialize cardname variable. | |
// Change variable below to test credit card number | |
long long cardnumber = 378282246310005; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validator(cardNumber){ | |
const cardArray = cardNumber.toString().split("").map((e) => parseInt(e) ) | |
validlen(cardArray); | |
const splitArr = arrSplit(cardArray) | |
const checksum = sumArrDigits(splitArr.arr1).reduce((a, c) => a + c) + splitArr.arr2.reduce((a, c) => a + c); | |
if (checksum % 10 == 0){ | |
const typeValidatorArr = cardArray.slice(0,2) | |
const typeValidatorInt = parseInt(typeValidatorArr.join("")) |