@boost/common
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -6,2 +6,18 @@ # Change Log | ||
## 1.7.0 - 2019-12-27 | ||
#### 🚀 Updates | ||
- **[Contract]** Updated `configure()` to accept a setter function. ([2938a9f](https://github.com/milesj/boost/commit/2938a9f)) | ||
#### 🐞 Fixes | ||
- **[Contract]** Dont deep freeze the options object. ([b378abf](https://github.com/milesj/boost/commit/b378abf)) | ||
**Note:** Version bump only for package @boost/common | ||
## 1.6.0 - 2019-12-07 | ||
@@ -8,0 +24,0 @@ |
import { Blueprint, Predicates } from 'optimal'; | ||
import { Optionable } from './types'; | ||
export default abstract class Contract<T extends object = {}> implements Optionable<T> { | ||
readonly options: Required<T>; | ||
readonly options: Readonly<Required<T>>; | ||
constructor(options?: T); | ||
@@ -11,3 +11,3 @@ /** | ||
*/ | ||
configure(options?: Partial<T>): Required<T>; | ||
configure(options?: Partial<T> | ((options: Required<T>) => Partial<T>)): Readonly<Required<T>>; | ||
/** | ||
@@ -14,0 +14,0 @@ * Define an optimal blueprint in which to validate and build the |
@@ -9,8 +9,4 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const optimal_1 = __importStar(require("optimal")); | ||
const deepFreeze_1 = __importDefault(require("./helpers/deepFreeze")); | ||
class Contract { | ||
@@ -32,6 +28,7 @@ constructor(options) { | ||
configure(options) { | ||
const nextOptions = typeof options === 'function' ? options(this.options) : options; | ||
// We don't want the options property to be modified directly, | ||
// so it's read only, but we still want to modify it with this function. | ||
// @ts-ignore | ||
this.options = deepFreeze_1.default(optimal_1.default({ ...this.options, ...options }, this.blueprint(optimal_1.predicates), { | ||
this.options = Object.freeze(optimal_1.default({ ...this.options, ...nextOptions }, this.blueprint(optimal_1.predicates), { | ||
name: this.constructor.name, | ||
@@ -38,0 +35,0 @@ })); |
{ | ||
"name": "@boost/common", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Common utilities for Boost applications.", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@boost/internal": "^1.0.1", | ||
"@boost/internal": "^1.0.2", | ||
"js-yaml": "^3.13.1", | ||
@@ -36,3 +36,3 @@ "json5": "^2.1.1", | ||
}, | ||
"gitHead": "a7fac69582efb763b9d5caa525a2f602245506b7" | ||
"gitHead": "2121f3e6c0b9a9db0559abd65a889253a74f3c03" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38183
691
Updated@boost/internal@^1.0.2