@coderich/util 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +2 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderich/util",
3
3
  "main": "src/index.js",
4
- "version": "0.1.9",
4
+ "version": "0.1.11",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
package/src/index.js CHANGED
@@ -19,7 +19,7 @@ exports.ucFirst = string => string.charAt(0).toUpperCase() + string.slice(1);
19
19
  exports.isPlainObjectOrArray = obj => Array.isArray(obj) || exports.isPlainObject(obj);
20
20
 
21
21
  exports.isPlainObject = (obj) => {
22
- if (obj == null) return false;
22
+ if (obj == null || Array.isArray(obj)) return false;
23
23
  const proto = Object.getPrototypeOf(obj);
24
24
  return proto === Object.prototype || proto.toString?.call?.(obj) === '[object Object]';
25
25
  };
@@ -131,7 +131,7 @@ exports.pipeline = (thunks, startValue) => {
131
131
  return thunks.reduce((promise, thunk) => {
132
132
  return promise.then((value) => {
133
133
  if (value !== undefined) $value = value;
134
- return Promise.resolve(thunk($value));
134
+ return Promise.resolve(thunk($value)).then((result = $value) => result);
135
135
  });
136
136
  }, Promise.resolve(startValue));
137
137
  };