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

21 lines (17 loc) 426 B
import { errorObject } from './errorObject'; let tryCatchTarget: Function; function tryCatcher(this: any): any { errorObject.e = undefined; try { return tryCatchTarget.apply(this, arguments); } catch (e) { errorObject.e = e; return errorObject; } finally { tryCatchTarget = undefined; } } export function tryCatch<T extends Function>(fn: T): T { tryCatchTarget = fn; return <any>tryCatcher; }