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

webidl-conversions

Package Overview
Dependencies
Maintainers
1
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 1.0.1 to 1.1.0

12

lib/index.js

@@ -5,4 +5,16 @@ var conversions = {};

var global_String = String;
var Number_isFinite = Number.isFinite;
conversions["boolean"] = val => !!val;
conversions["DOMString"] = val => global_String(val);
conversions["double"] = val => {
var asNumber = +val;
if (!Number_isFinite(asNumber)) {
throw new TypeError("Argument is not a finite floating-point value.");
}
return asNumber;
};

12

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

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

},
"repository": {
"type": "git",
"url": "https://github.com/domenic/webidl-conversions"
},
"repository": "domenic/webidl-conversions",
"keywords": [

@@ -25,7 +22,6 @@ "webidl",

"license": "BSD-2-Clause",
"bugs": "https://github.com/domenic/webidl-conversions/issues",
"devDependencies": {
"mocha": "^1.21.4",
"mocha-traceur": "domenic/mocha-traceur#patch-1",
"traceur": "^0.0.58"
"mocha-traceur": "^2.0.0",
"traceur": "^0.0.66"
},

@@ -32,0 +28,0 @@ "browserify": {

@@ -29,6 +29,8 @@ # WebIDL Type Conversions on JavaScript Values

So far only `boolean` and `DOMString` types are implemented. This list will grow over time in service of the [HTML as Custom Elements](https://github.com/dglazkov/html-as-custom-elements) project, but in the meantime, pull requests welcome!
So far only `boolean`, `DOMString`, and `double` types are implemented. This list will grow over time in service of the [HTML as Custom Elements](https://github.com/dglazkov/html-as-custom-elements) project, but in the meantime, pull requests welcome!
I'm not sure yet what the strategy will be for modifiers, e.g. [`[Clamp]`](http://heycam.github.io/webidl/#Clamp). Maybe something like `conversions["unsigned long"](x, { clamp: true })`? We'll see.
We might also want to extend the API to give better error messages, e.g. "Argument 1 of HTMLMediaElement.fastSeek is not a finite floating-point value" instead of "Argument is not a finite floating-point value." This would require passing in more information to the conversion functions than we currently do.
## Background

@@ -35,0 +37,0 @@

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