-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch exceptions #224
Catch exceptions #224
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import {error, invalidArgument} from './src/internal/throw'; | ||
|
||
if(typeof Object.create !== 'function') error('Please polyfill Object.create to use Fluture'); | ||
if(typeof Object.assign !== 'function') error('Please polyfill Object.assign to use Fluture'); | ||
if(typeof Array.isArray !== 'function') error('Please polyfill Array.isArray to use Fluture'); | ||
|
||
import concurrify from 'concurrify'; | ||
import type from 'sanctuary-type-identifiers'; | ||
import {throwInvalidArgument} from './src/internal/throw'; | ||
import {Future, of, reject, never} from './src/core'; | ||
import {FL} from './src/internal/const'; | ||
import {chainRec} from './src/chain-rec'; | ||
import {ap, map, bimap, chain, race, alt} from './src/dispatchers'; | ||
import {parallelAp} from './src/parallel-ap'; | ||
|
||
Future.of = Future[FL.of] = of; | ||
Future.chainRec = Future[FL.chainRec] = chainRec; | ||
|
@@ -20,7 +14,7 @@ Future.map = map; | |
Future.bimap = bimap; | ||
Future.chain = chain; | ||
|
||
var Par = concurrify(Future, never, race, parallelAp); | ||
var Par = concurrify(Future, never, race, function parallelAp(a, b){ return b._parallelAp(a) }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed |
||
Par.of = Par[FL.of]; | ||
Par.zero = Par[FL.zero]; | ||
Par.map = map; | ||
|
@@ -32,7 +26,7 @@ function isParallel(x){ | |
} | ||
|
||
function seq(par){ | ||
if(!isParallel(par)) invalidArgument('Future.seq', 0, 'to be a Par', par); | ||
if(!isParallel(par)) throwInvalidArgument('Future.seq', 0, 'to be a Par', par); | ||
return par.sequential; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,18 @@ | |
], | ||
"repository": "https://github.com/fluture-js/Fluture.git", | ||
"scripts": { | ||
"bench": "sanctuary-benchmark", | ||
"bench": "npm run build && sanctuary-benchmark", | ||
"build": "rollup -c", | ||
"clean": "rimraf npm-debug.log coverage index.js index.test.js", | ||
"clean": "rimraf npm-debug.log coverage index.js index.test.js .esm-cache .nyc_output node_modules/.cache", | ||
"lint": "eslint src test index.es.js README.md", | ||
"lint:readme": "remark --no-stdout --frail -u remark-validate-links README.md", | ||
"release": "npm outdated --long; xyz --edit --repo git@github.com:fluture-js/Fluture.git --tag 'X.Y.Z' --script scripts/distribute --increment", | ||
"test": "npm run lint && npm run lint:readme && npm run test:unit && npm run test:types", | ||
"test:unit": "npm run build && nyc --include src mocha --require @std/esm --ui bdd --reporter list --check-leaks --full-trace test/**.test.js", | ||
"test:coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"test": "npm run lint && npm run lint:readme && npm run test:unit && npm run test:types && npm run test:build", | ||
"test:unit": "npm run clean && mocha --require @std/esm --ui bdd --reporter list --full-trace --check-leaks --bail test/**.test.js", | ||
"test:build": "npm run clean && npm run build && mocha --require @std/esm --ui bdd --reporter dot --bail test/**.buildtest.js", | ||
"test:coverage": "npm run clean && nyc --include src mocha --require @std/esm --ui bdd --reporter dot test/**.test.js || true", | ||
"coverage:upload": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"coverage:report": "nyc report --reporter=html", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes facilitate potentially failing tests while testing for coverage -- annoyingly when testing |
||
"test:types": "tsc index.d.ts" | ||
}, | ||
"author": "Aldwin Vlasblom <aldwin.vlasblom@gmail.com> (https://github.com/Avaq)", | ||
|
@@ -73,7 +76,7 @@ | |
"fantasy-states": "^0.2.1", | ||
"jsverify": "^0.8.3", | ||
"mocha": "^4.0.0", | ||
"nyc": "^11.2.1", | ||
"nyc": "^11.4.1", | ||
"ramda": "^0.25.0", | ||
"remark-cli": "^5.0.0", | ||
"remark-validate-links": "^7.0.0", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk was useless, because
rollup
changes the order of code evaluation in such a way that this code is reached only after some parts have already tried to use these functions. It's also not super important, as it only served to slightly improve the error messages.