
Security News
Feross on Risky Business Weekly Podcast: npm’s Ongoing Supply Chain Attacks
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
@types/webidl-conversions
Advanced tools
TypeScript definitions for webidl-conversions
The @types/webidl-conversions package provides TypeScript type definitions for the webidl-conversions library, which is a utility for converting JavaScript values to WebIDL types as specified in the WebIDL specification. This is particularly useful when working with Web APIs in a type-safe manner, ensuring that values passed to and from Web APIs conform to the expected types.
Converting basic types
This feature demonstrates how to convert basic JavaScript types to WebIDL types, such as DOMString and boolean. The context option provides additional information for error messages.
import * as WebIDL from 'webidl-conversions';
let myString = WebIDL.DOMString('123', { context: 'Argument 1' });
let myBoolean = WebIDL.boolean('true', { context: 'Argument 2' });
Converting complex types
This feature shows the conversion of more complex JavaScript types to WebIDL types, like object and byte. It illustrates the flexibility of the library in handling various types.
import * as WebIDL from 'webidl-conversions';
let myObject = WebIDL.object({ a: 1, b: 2 }, { context: 'Argument 1' });
let myByte = WebIDL.byte('123', { context: 'Argument 2' });
webidl2js is a package that translates WebIDL into JavaScript implementations. Unlike @types/webidl-conversions, which focuses on type conversions, webidl2js deals with generating JavaScript bindings for WebIDL interfaces, making it more suited for implementing web platform APIs in JavaScript.
npm install --save @types/webidl-conversions
This package contains type definitions for webidl-conversions (https://github.com/jsdom/webidl-conversions#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webidl-conversions.
These definitions were written by ExE Boss, and BendingBender.
FAQs
TypeScript definitions for webidl-conversions
The npm package @types/webidl-conversions receives a total of 3,842,753 weekly downloads. As such, @types/webidl-conversions popularity was classified as popular.
We found that @types/webidl-conversions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.