@dereekb/util 8.6.1 → 8.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [8.7.2](https://github.com/dereekb/dbx-components/compare/v8.7.1-dev...v8.7.2) (2022-06-24)
6
+
7
+
8
+
9
+ ## [8.7.1](https://github.com/dereekb/dbx-components/compare/v8.7.0-dev...v8.7.1) (2022-06-24)
10
+
11
+
12
+
13
+ # [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)
14
+
15
+
16
+ ### Features
17
+
18
+ * added step, enforceStep to numberField ([a57b1c7](https://github.com/dereekb/dbx-components/commit/a57b1c7f9f0194874e4dcadafabf01ee49d44c48))
19
+
20
+
21
+
5
22
  ## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)
6
23
 
7
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "8.6.1",
3
+ "version": "8.7.2",
4
4
  "type": "commonjs",
5
5
  "exports": {
6
6
  ".": {
@@ -1,3 +1,4 @@
1
1
  export * from './factory';
2
2
  export * from './random';
3
3
  export * from './round';
4
+ export * from './number';
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./factory"), exports);
5
5
  tslib_1.__exportStar(require("./random"), exports);
6
6
  tslib_1.__exportStar(require("./round"), exports);
7
+ tslib_1.__exportStar(require("./number"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/number/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,mDAAyB;AACzB,kDAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/number/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,mDAAyB;AACzB,kDAAwB;AACxB,mDAAyB"}
@@ -0,0 +1,23 @@
1
+ import { Maybe } from '../value/maybe.type';
2
+ /**
3
+ * Returns true if the input value is divisible by the divisor.
4
+ *
5
+ * @param value
6
+ * @param divisor
7
+ * @returns
8
+ */
9
+ export declare function isNumberDivisibleBy(value: Maybe<number>, divisor: number): boolean;
10
+ export interface NearestDivisibleValues {
11
+ value: number;
12
+ divisor: number;
13
+ nearestCeil: number;
14
+ nearestFloor: number;
15
+ }
16
+ /**
17
+ * Returns true if the input value is divisible by the divisor.
18
+ *
19
+ * @param value
20
+ * @param divisor
21
+ * @returns
22
+ */
23
+ export declare function nearestDivisibleValues(value: number, divisor: number): NearestDivisibleValues;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nearestDivisibleValues = exports.isNumberDivisibleBy = void 0;
4
+ /**
5
+ * Returns true if the input value is divisible by the divisor.
6
+ *
7
+ * @param value
8
+ * @param divisor
9
+ * @returns
10
+ */
11
+ function isNumberDivisibleBy(value, divisor) {
12
+ const remainder = (value !== null && value !== void 0 ? value : 0) % divisor;
13
+ return remainder === 0;
14
+ }
15
+ exports.isNumberDivisibleBy = isNumberDivisibleBy;
16
+ /**
17
+ * Returns true if the input value is divisible by the divisor.
18
+ *
19
+ * @param value
20
+ * @param divisor
21
+ * @returns
22
+ */
23
+ function nearestDivisibleValues(value, divisor) {
24
+ const point = value / divisor;
25
+ const ceilPoint = Math.ceil(point);
26
+ const floorPoint = Math.floor(point);
27
+ return {
28
+ value,
29
+ divisor,
30
+ nearestCeil: ceilPoint * divisor,
31
+ nearestFloor: floorPoint * divisor
32
+ };
33
+ }
34
+ exports.nearestDivisibleValues = nearestDivisibleValues;
35
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/number/number.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,KAAoB,EAAE,OAAe;IACvE,MAAM,SAAS,GAAG,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,CAAC,CAAC,GAAG,OAAO,CAAC;IACzC,OAAO,SAAS,KAAK,CAAC,CAAC;AACzB,CAAC;AAHD,kDAGC;AASD;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,KAAa,EAAE,OAAe;IACnE,MAAM,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAErC,OAAO;QACL,KAAK;QACL,OAAO;QACP,WAAW,EAAE,SAAS,GAAG,OAAO;QAChC,YAAY,EAAE,UAAU,GAAG,OAAO;KACnC,CAAC;AACJ,CAAC;AAXD,wDAWC"}
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [8.7.2](https://github.com/dereekb/dbx-components/compare/v8.7.1-dev...v8.7.2) (2022-06-24)
6
+
7
+
8
+
9
+ ## [8.7.1](https://github.com/dereekb/dbx-components/compare/v8.7.0-dev...v8.7.1) (2022-06-24)
10
+
11
+
12
+
13
+ # [8.7.0](https://github.com/dereekb/dbx-components/compare/v8.6.1-dev...v8.7.0) (2022-06-23)
14
+
15
+
16
+
5
17
  ## [8.6.1](https://github.com/dereekb/dbx-components/compare/v8.6.0-dev...v8.6.1) (2022-06-23)
6
18
 
7
19
 
package/test/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "8.6.1",
3
+ "version": "8.7.2",
4
+ "type": "commonjs",
4
5
  "main": "./src/index.js",
5
6
  "typings": "./src/index.d.ts",
6
7
  "dependencies": {},
7
8
  "peerDependencies": {
8
- "@dereekb/util": "8.6.1",
9
+ "@dereekb/util": "8.7.2",
9
10
  "make-error": "^1.3.0",
10
11
  "ts-essentials": "^9.1.2",
11
12
  "extra-set": "^2.2.11",