Skip to content

Commit

Permalink
fix: obj undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed May 6, 2020
1 parent 5d9699d commit 87450a5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"trailingComma": "none",
"arrowParens": "always",
"printWidth": 100,
"printWidth": 80,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"tabWidth": 2,
Expand Down
10 changes: 7 additions & 3 deletions dist/next-is-promise.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/next-is-promise.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/next-is-promise.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* name: @feizheng/next-is-promise
* description: Test whether an object looks like a promises-a+ promise.
* homepage: https://github.com/afeiship/next-is-promise
* version: 1.0.0
* date: 2020-05-06T00:25:49.825Z
* version: 1.0.1
* date: 2020-05-06T00:33:45.607Z
* license: MIT
*/
!function(){var e=e||this||window||Function("return this")(),o=e.nx||require("@feizheng/next-js-core2"),n="function";o.isPromise=function(e){return!!e&&("object"==typeof e||typeof e==n)&&typeof obj.then==n},"undefined"!=typeof module&&module.exports&&(module.exports=o.isPromise)}();
!function(){var e=e||this||window||Function("return this")(),o=e.nx||require("@feizheng/next-js-core2"),n="function";o.isPromise=function(e){return!!e&&("object"==typeof e||typeof e==n)&&typeof e.then==n},"undefined"!=typeof module&&module.exports&&(module.exports=o.isPromise)}();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@feizheng/next-is-promise",
"version": "1.0.0",
"version": "1.0.1",
"description": "Test whether an object looks like a promises-a+ promise.",
"homepage": "https://github.com/afeiship/next-is-promise",
"author": {
Expand Down
6 changes: 5 additions & 1 deletion src/next-is-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
var FUNC = 'function';

nx.isPromise = function (inObj) {
return !!inObj && (typeof inObj === OBJ || typeof inObj === FUNC) && typeof obj.then === FUNC;
return (
!!inObj &&
(typeof inObj === OBJ || typeof inObj === FUNC) &&
typeof inObj.then === FUNC
);
};

if (typeof module !== 'undefined' && module.exports) {
Expand Down

0 comments on commit 87450a5

Please sign in to comment.