UNPKG

@0xcert/utils

Version:

General utility module with common helper functions.

18 lines 655 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const spec_1 = require("@hayspec/spec"); const __1 = require("../.."); const spec = new spec_1.Spec(); spec.test('converts numbers to floats', (ctx) => { ctx.is(__1.toFloat(9000), 9000); ctx.is(__1.toFloat(9000.1982), 9000.1982); ctx.is(__1.toFloat(0.1982), 0.1982); ctx.is(__1.toFloat('10000.124'), 10000.124); }); spec.test('handles non-numeric and other invalid values', (ctx) => { ctx.is(__1.toFloat('foo'), 0); ctx.is(__1.toFloat(null), 0); ctx.is(__1.toFloat(undefined), 0); }); exports.default = spec; //# sourceMappingURL=to-float.test.js.map