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

@loaders.gl/schema

Package Overview
Dependencies
Maintainers
9
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/schema

Table format APIs for JSON, CSV, etc...

  • 4.3.0-alpha.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
80K
decreased by-68.32%
Maintainers
9
Weekly downloads
 
Created

What is @loaders.gl/schema?

@loaders.gl/schema is a library that provides utilities for working with data schemas, including parsing, validation, and transformation of structured data. It is part of the larger loaders.gl suite, which is designed for loading and processing large datasets efficiently.

What are @loaders.gl/schema's main functionalities?

Schema Parsing

This feature allows you to define and parse a schema for structured data. The code sample demonstrates how to create a new schema with fields for 'id', 'name', and 'age'.

const { Schema } = require('@loaders.gl/schema');
const schema = new Schema({
  fields: [
    {name: 'id', type: 'integer'},
    {name: 'name', type: 'string'},
    {name: 'age', type: 'integer'}
  ]
});
console.log(schema);

Data Validation

This feature allows you to validate data against a defined schema. The code sample shows how to validate an object with 'id', 'name', and 'age' fields against the schema.

const { Schema, validate } = require('@loaders.gl/schema');
const schema = new Schema({
  fields: [
    {name: 'id', type: 'integer'},
    {name: 'name', type: 'string'},
    {name: 'age', type: 'integer'}
  ]
});
const data = { id: 1, name: 'John Doe', age: 30 };
const isValid = validate(schema, data);
console.log(isValid);

Data Transformation

This feature allows you to transform data to match the types defined in the schema. The code sample demonstrates transforming string values to their respective types as defined in the schema.

const { Schema, transform } = require('@loaders.gl/schema');
const schema = new Schema({
  fields: [
    {name: 'id', type: 'integer'},
    {name: 'name', type: 'string'},
    {name: 'age', type: 'integer'}
  ]
});
const data = { id: '1', name: 'John Doe', age: '30' };
const transformedData = transform(schema, data);
console.log(transformedData);

Other packages similar to @loaders.gl/schema

Keywords

FAQs

Package last updated on 25 Apr 2024

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