From 1cc27fcc5e11297ef49e61e39b000a056378c849 Mon Sep 17 00:00:00 2001 From: Robert Kuykendall Date: Tue, 5 Mar 2019 17:37:05 -0500 Subject: [PATCH] v1.1.1 --- dist/interfaces.d.ts | 10 ++++----- dist/utils.cjs.js | 52 ++++++++++++++++++++++++++++++++++++-------- dist/utils.esm.js | 52 ++++++++++++++++++++++++++++++++++++-------- dist/utils.umd.js | 52 ++++++++++++++++++++++++++++++++++++-------- package.json | 2 +- 5 files changed, 135 insertions(+), 33 deletions(-) diff --git a/dist/interfaces.d.ts b/dist/interfaces.d.ts index d942c2e..6185e27 100644 --- a/dist/interfaces.d.ts +++ b/dist/interfaces.d.ts @@ -1,7 +1,7 @@ export interface IAddress { - address1?: string; - address2?: string; - city?: string; - state?: string; - zip_code?: string; + address1?: string | null; + address2?: string | null; + city?: string | null; + state?: string | null; + zip_code?: string | null; } diff --git a/dist/utils.cjs.js b/dist/utils.cjs.js index 6eb9578..3a14502 100644 --- a/dist/utils.cjs.js +++ b/dist/utils.cjs.js @@ -16,14 +16,11 @@ var parser = _interopDefault(require('html-react-parser')); var lodash = require('lodash'); /* - * - * decimal.js v10.0.2 + * decimal.js v10.1.1 * An arbitrary-precision Decimal type for JavaScript. * https://github.com/MikeMcl/decimal.js - * Copyright (c) 2018 Michael Mclaughlin + * Copyright (c) 2019 Michael Mclaughlin * MIT Licence - * https://github.com/MikeMcl/decimal.js/LICENCE - * */ @@ -4271,8 +4268,27 @@ function clone(obj) { // Duplicate. if (v instanceof Decimal) { x.s = v.s; - x.e = v.e; - x.d = (v = v.d) ? v.slice() : v; + + if (external) { + if (!v.d || v.e > Decimal.maxE) { + + // Infinity. + x.e = NaN; + x.d = null; + } else if (v.e < Decimal.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + return; } @@ -4296,8 +4312,23 @@ function clone(obj) { // Fast path for small integers. if (v === ~~v && v < 1e7) { for (e = 0, i = v; i >= 10; i /= 10) e++; - x.e = e; - x.d = [v]; + + if (external) { + if (e > Decimal.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + return; // Infinity, NaN. @@ -4800,6 +4831,9 @@ function trunc(x) { } +P[Symbol.for('nodejs.util.inspect.custom')] = P.toString; +P[Symbol.toStringTag] = 'Decimal'; + // Create and configure initial Decimal constructor. var Decimal = clone(DEFAULTS); diff --git a/dist/utils.esm.js b/dist/utils.esm.js index ed1d335..0bfc77b 100644 --- a/dist/utils.esm.js +++ b/dist/utils.esm.js @@ -9,14 +9,11 @@ import parser from 'html-react-parser'; import { isString, isNumber, has, result, get, times, isBoolean, escape, startCase, sortBy, map, reject, mapValues } from 'lodash'; /* - * - * decimal.js v10.0.2 + * decimal.js v10.1.1 * An arbitrary-precision Decimal type for JavaScript. * https://github.com/MikeMcl/decimal.js - * Copyright (c) 2018 Michael Mclaughlin + * Copyright (c) 2019 Michael Mclaughlin * MIT Licence - * https://github.com/MikeMcl/decimal.js/LICENCE - * */ @@ -4264,8 +4261,27 @@ function clone(obj) { // Duplicate. if (v instanceof Decimal) { x.s = v.s; - x.e = v.e; - x.d = (v = v.d) ? v.slice() : v; + + if (external) { + if (!v.d || v.e > Decimal.maxE) { + + // Infinity. + x.e = NaN; + x.d = null; + } else if (v.e < Decimal.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + return; } @@ -4289,8 +4305,23 @@ function clone(obj) { // Fast path for small integers. if (v === ~~v && v < 1e7) { for (e = 0, i = v; i >= 10; i /= 10) e++; - x.e = e; - x.d = [v]; + + if (external) { + if (e > Decimal.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + return; // Infinity, NaN. @@ -4793,6 +4824,9 @@ function trunc(x) { } +P[Symbol.for('nodejs.util.inspect.custom')] = P.toString; +P[Symbol.toStringTag] = 'Decimal'; + // Create and configure initial Decimal constructor. var Decimal = clone(DEFAULTS); diff --git a/dist/utils.umd.js b/dist/utils.umd.js index 3387a05..f3260cb 100644 --- a/dist/utils.umd.js +++ b/dist/utils.umd.js @@ -10,14 +10,11 @@ parser = parser && parser.hasOwnProperty('default') ? parser['default'] : parser; /* - * - * decimal.js v10.0.2 + * decimal.js v10.1.1 * An arbitrary-precision Decimal type for JavaScript. * https://github.com/MikeMcl/decimal.js - * Copyright (c) 2018 Michael Mclaughlin + * Copyright (c) 2019 Michael Mclaughlin * MIT Licence - * https://github.com/MikeMcl/decimal.js/LICENCE - * */ @@ -4265,8 +4262,27 @@ // Duplicate. if (v instanceof Decimal) { x.s = v.s; - x.e = v.e; - x.d = (v = v.d) ? v.slice() : v; + + if (external) { + if (!v.d || v.e > Decimal.maxE) { + + // Infinity. + x.e = NaN; + x.d = null; + } else if (v.e < Decimal.minE) { + + // Zero. + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + return; } @@ -4290,8 +4306,23 @@ // Fast path for small integers. if (v === ~~v && v < 1e7) { for (e = 0, i = v; i >= 10; i /= 10) e++; - x.e = e; - x.d = [v]; + + if (external) { + if (e > Decimal.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + return; // Infinity, NaN. @@ -4794,6 +4825,9 @@ } + P[Symbol.for('nodejs.util.inspect.custom')] = P.toString; + P[Symbol.toStringTag] = 'Decimal'; + // Create and configure initial Decimal constructor. var Decimal = clone(DEFAULTS); diff --git a/package.json b/package.json index bac709b..4b5b1c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mighty-justice/utils", - "version": "1.1.0", + "version": "1.1.1", "description": "Standardization of small utilities across Mighty", "main": "dist/utils.cjs.js", "module": "dist/utils.esm.js",