UNPKG

luhn-generator

Version:

A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm

16 lines (12 loc) 256 B
'use strict'; module.exports = object => { if (typeof object !== 'object') { throw new TypeError('Expected an object'); } const ret = {}; for (const key of Object.keys(object)) { const value = object[key]; ret[value] = key; } return ret; };