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

cddl2ts

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cddl2ts

A Node.js package that can generate a TypeScript definition based on a CDDL file

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35
decreased by-88.14%
Maintainers
1
Weekly downloads
 
Created
Source

CDDL to TypeScript Test

A Node.js package that can generate a TypeScript definition based on a CDDL file

CDDL expresses Concise Binary Object Representation (CBOR) data structures (RFC 7049). Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON. This package allows you to transform a CDDL file into a TypeScript interface that you can use for other TypeScript project.

Related projects:

Install

To install this package run:

$ npm install cddl2ts

Using this package

This package exposes a CLI as well as a programmatic interface for transforming CDDL into TypeScript.

CLI

npx cddl2ts ./path/to/interface.cddl &> ./path/to/interface.ts

Programmatic Interface

The module exports a transform method that takes an CDDL AST object and returns a TypeScript definition as string, e.g.:

import { transform } from 'cddl2ts'

/**
 * spec.cddl:
 *
 * session.CapabilityRequest = {
 *   ?acceptInsecureCerts: bool,
 *   ?browserName: text,
 *   ?browserVersion: text,
 *   ?platformName: text,
 * };
 */
const ts = transform('./spec.cddl')
console.log(ts)
/**
 * outputs:
 *
 * interface SessionCapabilityRequest {
 *   acceptInsecureCerts?: boolean,
 *   browserName?: string,
 *   browserVersion?: string,
 *   platformName?: string,
 * }
 */

If you are interested in this project, please feel free to contribute ideas or code patches. Have a look at our contributing guidelines to get started.

Keywords

FAQs

Package last updated on 23 May 2023

Did you know?

Socket

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.

Install

Related posts

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