-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: browser端,将 is-type-of 包的依赖处理为 shim (#801)
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"printWidth": 80, | ||
"bracketSpacing": true, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { Stream } = require('stream'); | ||
const isArray = require('../lib/common/utils/isArray'); | ||
|
||
module.exports.string = function isString(obj) { | ||
return typeof obj === 'string'; | ||
}; | ||
|
||
module.exports.array = isArray; | ||
|
||
module.exports.buffer = Buffer.isBuffer; | ||
|
||
function isStream(obj) { | ||
return obj instanceof Stream; | ||
} | ||
|
||
module.exports.writableStream = function isWritableStream(obj) { | ||
return ( | ||
isStream(obj) && | ||
typeof obj._write === 'function' && | ||
typeof obj._writableState === 'object' | ||
); | ||
}; |