Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webidl-conversions

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webidl-conversions - npm Package Compare versions

Comparing version 4.0.2 to 5.0.0

39

lib/index.js

@@ -293,6 +293,35 @@ "use strict";

const abByteLengthGetter =
Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
function isArrayBuffer(V) {
try {
abByteLengthGetter.call(V);
return true;
} catch (e) {
return false;
}
}
// I don't think we can reliably detect detached ArrayBuffers.
exports.ArrayBuffer = (V, opts) => {
if (!isArrayBuffer(V)) {
throw new TypeError(_("is not a view on an ArrayBuffer object", opts));
}
return V;
};
const dvByteLengthGetter =
Object.getOwnPropertyDescriptor(DataView.prototype, "byteLength").get;
exports.DataView = (V, opts) => {
try {
dvByteLengthGetter.call(V);
return V;
} catch (e) {
throw new TypeError(_("is not a view on an DataView object", opts));
}
};
[
Error,
ArrayBuffer, // The IsDetachedBuffer abstract operation is not exposed in JS
DataView, Int8Array, Int16Array, Int32Array, Uint8Array,
Int8Array, Int16Array, Int32Array, Uint8Array,
Uint16Array, Uint32Array, Uint8ClampedArray, Float32Array, Float64Array

@@ -303,3 +332,3 @@ ].forEach(func => {

exports[name] = (V, opts) => {
if (!(V instanceof func)) {
if (!ArrayBuffer.isView(V) || V.constructor.name !== name) {
throw new TypeError(_(`is not ${article} ${name} object`, opts));

@@ -323,3 +352,3 @@ }

exports.BufferSource = (V, opts) => {
if (!(ArrayBuffer.isView(V) || V instanceof ArrayBuffer)) {
if (!ArrayBuffer.isView(V) && !isArrayBuffer(V)) {
throw new TypeError(_("is not an ArrayBuffer object or a view on one", opts));

@@ -326,0 +355,0 @@ }

11

package.json
{
"name": "webidl-conversions",
"version": "4.0.2",
"version": "5.0.0",
"description": "Implements the WebIDL algorithms for converting to and from JavaScript values",

@@ -23,6 +23,9 @@ "main": "lib/index.js",

"devDependencies": {
"eslint": "^3.15.0",
"mocha": "^1.21.4",
"nyc": "^10.1.2"
"eslint": "^6.7.2",
"mocha": "^6.2.2",
"nyc": "^14.1.1"
},
"engines": {
"node": ">=8"
}
}

@@ -43,3 +43,2 @@ # Web IDL Type Conversions on JavaScript Values

- [`object`](https://heycam.github.io/webidl/#es-object)
- [`Error`](https://heycam.github.io/webidl/#es-Error)
- [Buffer source types](https://heycam.github.io/webidl/#es-buffer-source-types)

@@ -81,2 +80,2 @@

The _only_ people who should use this are those trying to create faithful implementations (or polyfills) of web platform interfaces defined in Web IDL. Its main consumer is the [jsdom](https://github.com/tmpvar/jsdom) project.
The _only_ people who should use this are those trying to create faithful implementations (or polyfills) of web platform interfaces defined in Web IDL. Its main consumer is the [jsdom](https://github.com/jsdom/jsdom) project.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc