Comparing version 0.5.1 to 0.5.2
@@ -5,2 +5,8 @@ # Changelog | ||
## 0.5.2 | ||
### Internal | ||
* Share the same object as prototype between `OptionT.Some` and `OptionT.None`. | ||
## 0.5.1 | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "option-t", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Option type implementation whose APIs are inspired by Rust's `Option<T>`.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -27,3 +27,14 @@ /* | ||
var OptionTProto = Object.freeze({ | ||
/** | ||
* @constructor | ||
* @template T | ||
* | ||
* A base object of `Option<T>`. | ||
* This is only used to `option instanceof OptionT` | ||
* in an language environment which does not have an interface type system. | ||
* | ||
* The usecase example is a `React.PropTypes. | ||
*/ | ||
var OptionT = function OptionTBase() {}; | ||
OptionT.prototype = Object.freeze({ | ||
/** | ||
@@ -181,14 +192,3 @@ * Return whether this is `Some<T>` or not. | ||
/** | ||
* @constructor | ||
* @template T | ||
* | ||
* A base object of `Option<T>`. | ||
* This is only used to `option instanceof OptionT` | ||
* in an language environment which does not have an interface type system. | ||
* | ||
* The usecase example is a `React.PropTypes. | ||
*/ | ||
var OptionT = function OptionTBase() {}; | ||
OptionT.prototype = OptionTProto; | ||
var OptionPrototype = new OptionT(); | ||
@@ -217,3 +217,3 @@ /** | ||
}; | ||
Some.prototype = new OptionT(); | ||
Some.prototype = OptionPrototype; | ||
@@ -240,3 +240,3 @@ /** | ||
}; | ||
None.prototype = new OptionT(); | ||
None.prototype = OptionPrototype; | ||
@@ -243,0 +243,0 @@ module.exports = { |
16633