Comparing version 0.18.3 to 1.0.0
@@ -5,2 +5,25 @@ # Changelog | ||
## 1.0.0 | ||
### Breaking Change (Possible) | ||
- These would causes `TypeError` instread of `Error`. ([#132](https://github.com/saneyuki/option-t.js/pull/132)) | ||
- `Option<T>.unwrap()` | ||
- `Option<T>.expect()` | ||
- `Result<T, E>.unwrap()` | ||
- `Result<T, E>.unwrapErr()` | ||
- `Result<T, E>.expect()` | ||
### Internals | ||
- Remove Node v5 from CI. ([#136](https://github.com/saneyuki/option-t.js/pull/136)) | ||
### Documentation | ||
* Add links to pull request for CHANGELOG.md. ([#129](https://github.com/saneyuki/option-t.js/pull/129)) | ||
* Fix the sample code of casting from `Option<T>` to `Promise`. ([#130](https://github.com/saneyuki/option-t.js/pull/130)) | ||
## 0.18.3 | ||
@@ -10,3 +33,3 @@ | ||
* Fix the link to API documentations. | ||
* Fix the link to API documentations.([#128](https://github.com/saneyuki/option-t.js/pull/128)) | ||
@@ -18,3 +41,3 @@ | ||
* Add more descriptions about runtime nullability checking in README.md | ||
* Add more descriptions about runtime nullability checking in README.md ([#127](https://github.com/saneyuki/option-t.js/pull/127)) | ||
@@ -26,3 +49,3 @@ | ||
* Add some semantics description to README.md | ||
* Add some semantics description to README.md ([#126](https://github.com/saneyuki/option-t.js/pull/126)) | ||
@@ -34,5 +57,5 @@ | ||
#### Remove `Option<T>.asPromise()` | ||
#### Remove `Option<T>.asPromise()` ([#125](https://github.com/saneyuki/option-t.js/pull/125)) | ||
In previous version (~v0.17), we provide `Option<T>.asPromise()` utility method for this purpose. | ||
In previous version (~v0.17), we provide `Option<T>.asPromise()` utility method casting from `Option<T>` to `Promise`. | ||
Its methods always treats `None` as a rejected `Promise`. | ||
@@ -63,3 +86,3 @@ But there are various cases which we would not like to cast to a Promise from an Optional type with single way, | ||
result.value = v; | ||
return Promise.resolve(v); | ||
return Promise.resolve(result); | ||
}); | ||
@@ -66,0 +89,0 @@ } |
{ | ||
"name": "option-t", | ||
"version": "0.18.3", | ||
"version": "1.0.0", | ||
"description": "Option type implementation whose APIs are inspired by Rust's `Option<T>`.", | ||
@@ -19,3 +19,3 @@ "main": "src/index.js", | ||
"scripts": { | ||
"lint": "eslint ./src/ ./test/ .eslintrc.js", | ||
"lint": "eslint . ./**/.eslintrc.js --ext .js", | ||
"typetest": "tsc", | ||
@@ -53,9 +53,9 @@ "pretest": "npm run lint && npm run typetest", | ||
"devDependencies": { | ||
"eslint": "^2.4.0", | ||
"eslint": "^3.0.1", | ||
"espower-loader": "^1.0.0", | ||
"intelli-espower-loader": "^1.0.0", | ||
"mocha": "^2.3.4", | ||
"power-assert": "^1.3.1", | ||
"intelli-espower-loader": "^1.0.1", | ||
"mocha": "^2.5.3", | ||
"power-assert": "^1.4.1", | ||
"promise-test-helper": "^0.2.1", | ||
"typescript": "^1.8.9" | ||
"typescript": "^1.8.10" | ||
}, | ||
@@ -62,0 +62,0 @@ "typings": "./option-t.es6.d.ts", |
@@ -84,3 +84,3 @@ # option-t | ||
result.value = v; | ||
return Promise.resolve(v); | ||
return Promise.resolve(result); | ||
}); | ||
@@ -87,0 +87,0 @@ } |
@@ -13,3 +13,5 @@ /*eslint quote-props: [2, "always"] */ | ||
'env': { | ||
'node': true, | ||
'es6': false, | ||
'node': false, | ||
'commonjs': true, | ||
}, | ||
@@ -16,0 +18,0 @@ |
@@ -63,3 +63,3 @@ /** | ||
* @return {T} | ||
* @throws {Error} | ||
* @throws {TypeError} | ||
* Throws if the self value equals `None`. | ||
@@ -69,3 +69,3 @@ */ | ||
if (!this.is_some) { | ||
throw new Error('called `unwrap()` on a `None` value'); | ||
throw new TypeError('called `unwrap()` on a `None` value'); | ||
} | ||
@@ -107,3 +107,3 @@ | ||
* @return {T} | ||
* @throws {Error} | ||
* @throws {TypeError} | ||
* Throws a custom error with provided `msg` | ||
@@ -114,3 +114,3 @@ * if the self value equals `None`. | ||
if (!this.is_some) { | ||
throw new Error(msg); | ||
throw new TypeError(msg); | ||
} | ||
@@ -284,3 +284,3 @@ | ||
*/ | ||
var Some = function OptionTSome(val) { | ||
function Some(val) { | ||
/* eslint-disable camelcase */ | ||
@@ -300,3 +300,3 @@ /** | ||
Object.seal(this); | ||
}; | ||
} | ||
Some.prototype = new OptionT(); | ||
@@ -309,3 +309,3 @@ | ||
*/ | ||
var None = function OptionTNone() { | ||
function None() { | ||
/* eslint-disable camelcase */ | ||
@@ -325,3 +325,3 @@ /** | ||
Object.seal(this); | ||
}; | ||
} | ||
None.prototype = new OptionT(); | ||
@@ -328,0 +328,0 @@ |
@@ -220,3 +220,3 @@ /** | ||
* | ||
* @throws {Error} | ||
* @throws {TypeError} | ||
* Throws if the self is a `Err`. | ||
@@ -233,3 +233,3 @@ */ | ||
* | ||
* @throws {Error} | ||
* @throws {TypeError} | ||
* Throws if the self is a `Ok`. | ||
@@ -239,3 +239,3 @@ */ | ||
if (this._is_ok) { | ||
throw new Error('called `unwrapErr()` on a `Ok` value'); | ||
throw new TypeError('called `unwrapErr()` on a `Ok` value'); | ||
} | ||
@@ -284,3 +284,3 @@ else { | ||
* | ||
* @throws {Error} | ||
* @throws {TypeError} | ||
* Throws the passed `message` if the self is a `Err`. | ||
@@ -293,3 +293,3 @@ */ | ||
else { | ||
throw new Error(message); | ||
throw new TypeError(message); | ||
} | ||
@@ -296,0 +296,0 @@ }, |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
64403
1309
1