This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
scalars 0.1.0-alpha.0
Install from the command line:
Learn more about npm packages
$ npm install @neuledge/scalars@0.1.0-alpha.0
Install via package.json:
"@neuledge/scalars": "0.1.0-alpha.0"
About this version
A set of Neuledge Engine scalars that can be used on the schema definition.
This library is not intended to be used directly. It is a dependency of the main package.
npm install @neuledge/scalars
import { Integer, String, DateTime } from '@neuledge/scalars';
// define the state scalars
const stateScalars = {
id: { type: Integer, index: 1 },
name: { type: String, index: 2 },
description: { type: String, index: 3, nullable: true },
};
// validate a scalar value
const value: ScalarValue<typeof DateTime> = DateTime.encode(
new Date('2020-01-01'),
); // 1577836800000
// decode a scalar value
const decodedValue: DateTime = DateTime.decode(value); // Date('2020-01-01')
Neuledge is Apache 2.0 licensed.