UNPKG

typia

Version:

Superfast runtime validators with only one line

1 lines 741 B
{"version":3,"file":"_isMultipleOf.mjs","names":[],"sources":["../../src/internal/_isMultipleOf.ts"],"sourcesContent":["import { _decimalDecompose, _decimalDivide } from \"./_decimal\";\n\nexport const _isMultipleOf = (value: number, multipleOf: number): boolean => {\n const divisor = _decimalDecompose(multipleOf);\n if (divisor === null || divisor.coefficient <= BigInt(0)) return false;\n const ratio = _decimalDivide(value, divisor);\n return ratio !== null && ratio.numerator % ratio.denominator === BigInt(0);\n};\n"],"mappings":";;AAEA,MAAa,iBAAiB,OAAe,eAAgC;CAC3E,MAAM,UAAU,kBAAkB,UAAU;CAC5C,IAAI,YAAY,QAAQ,QAAQ,eAAe,OAAO,CAAC,GAAG,OAAO;CACjE,MAAM,QAAQ,eAAe,OAAO,OAAO;CAC3C,OAAO,UAAU,QAAQ,MAAM,YAAY,MAAM,gBAAgB,OAAO,CAAC;AAC3E"}