churi
TypeScript icon, indicating that this package has built-in type declarations

0.15.0 • Public • Published

ChURI

ChURI is a polyglot serializer, deserializer and validator supporting various data formats.

The data processing is based on data schemas. Schemas are written in TypeScript. ChURI compiles such schemas into efficient code implementing serializers, deserializers, and validators for the data conforming to those schemas.

The main data format supported is URI Charge Notation, which is used to encode data included into URI. Such URI is called Charged URI, or ChURI.

Other data formats supported out of the box:

  • JSON
  • application/x-www-form-urlencoded (URI query parameters)
  • URL-encoded
  • plain text

Some formats support insets containing data in another formats. For example, the application/x-www-form-urlencoded format allows query parameter values to be encoded as URL-encoded ones, as plain text, or as URI Charge. The choice is made by data schema.

NPM Build Status Code Quality Coverage GitHub Project API Documentation

Charged URI and URI Charge

Charged URI (ChURI) may include arbitrary structured data. The data is encoded with URI Charge Notation.

It is like JSON for GET requests, but may include even more:

https://example.com/!v(3)api/user;id=0n302875106592253/article;slug=hello-world/comments?date=since(!date'1970-01-01)till(!now)&range=from(10)to(20)

See the explanation >>>

Read more about URI Charge Notation >>>

This Package

This package provides:

  • ChURI class, which is a read-only URL class that grants access to charges.
  • URI charging utilities.
  • Schema-based parser, serializer, and validator.
  • URI Charge Notation support
  • JSON support.
  • application/x-www-form-urlencoded format support.
  • Other formats support, such as plain text and URI-encoded values.

Package Sidebar

Install

npm i churi

Weekly Downloads

3

Version

0.15.0

License

MIT

Unpacked Size

1.48 MB

Total Files

71

Last publish

Collaborators

  • lorus