Skip to content

Commit

Permalink
feat: remove default export in favour of named export
Browse files Browse the repository at this point in the history
BREAKING CHANGE: There is no longer a default export. Use the named export instead, e.g. use `import
{chain} from "@softwareventures/chain"` instead of `import chain from "@softwareventures/chain"`.
  • Loading branch information
djcsdy committed Dec 11, 2022
1 parent 7cf8292 commit 93229ee
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 102 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ npm-debug.log
*.js
*.d.ts
*.js.map
!/fix-types-for-back-compat.js
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ node_modules
*.d.ts
*.js.map
!/types/*.d.ts
!/fix-types-for-back-compat.js
88 changes: 0 additions & 88 deletions fix-types-for-back-compat.js

This file was deleted.

13 changes: 2 additions & 11 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
interface Chain<T> {
export interface Chain<T> {
readonly value: T;
map: <U>(f: (x: T) => U) => Chain<U>;
then: <U>(f: (x: T) => Chain<U>) => Chain<U>;
}

function chain<T>(x: T): Chain<T> {
export function chain<T>(x: T): Chain<T> {
return {
value: x,
map: f => chain(f(x)),
then: f => f(x)
};
}

// For forward compatibility with v3.0
chain.chain = chain;

/** @deprecated For backwards compatibility with versions < v1.0.1.
* Will be removed in v3.0. */
chain.default = chain;

export = chain;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"pre-commit": "precise-commits",
"fix": "tsc --noEmit && eslint --fix . && prettier --write .",
"lint": "tsc --noEmit && eslint . && prettier --check .",
"prepare": "husky install && tsc && node ./fix-types-for-back-compat.js",
"prepare": "husky install && tsc",
"semantic-release": "semantic-release",
"test": "ava"
},
Expand Down

0 comments on commit 93229ee

Please sign in to comment.