mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
buffer: fix validation of options in Blob
constructor
PR-URL: https://github.com/nodejs/node/pull/45156 Refs: https://webidl.spec.whatwg.org/#es-dictionary Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
17ae2ab750
commit
d6ee27445b
3 changed files with 53 additions and 4 deletions
|
@ -61,8 +61,8 @@ const {
|
|||
} = require('internal/errors');
|
||||
|
||||
const {
|
||||
validateObject,
|
||||
isUint32,
|
||||
validateDictionary,
|
||||
} = require('internal/validators');
|
||||
|
||||
const kHandle = Symbol('kHandle');
|
||||
|
@ -138,17 +138,17 @@ class Blob {
|
|||
* }} [options]
|
||||
* @constructs {Blob}
|
||||
*/
|
||||
constructor(sources = [], options = kEmptyObject) {
|
||||
constructor(sources = [], options) {
|
||||
if (sources === null ||
|
||||
typeof sources[SymbolIterator] !== 'function' ||
|
||||
typeof sources === 'string') {
|
||||
throw new ERR_INVALID_ARG_TYPE('sources', 'a sequence', sources);
|
||||
}
|
||||
validateObject(options, 'options');
|
||||
validateDictionary(options, 'options');
|
||||
let {
|
||||
type = '',
|
||||
endings = 'transparent',
|
||||
} = options;
|
||||
} = options ?? kEmptyObject;
|
||||
|
||||
endings = `${endings}`;
|
||||
if (endings !== 'transparent' && endings !== 'native')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue