All files / json-type/src index.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                                                                                                    4x 4x 4x 4x  
/**
 * `json-type`
 *
 * Implements types and builder for JSON Type.
 *
 * Use {@link t} builder instance to build your JSON types.
 *
 * ```ts
 * import {t} from '@jsonjoy.com/json-type';
 *
 * const userType = t.Object(
 *   t.prop('id', t.num),
 *   t.prop('name', t.str),
 * );
 * ```
 *
 * Define basic types, for example, a string:
 *
 * ```ts
 * t.String(); // { kind: 'str' }
 * ```
 *
 * Define complex types:
 *
 * ```ts
 * const type = t.Object(
 *   t.prop('collection', t.Object(
 *     t.prop('id', t.String({format: 'ascii', noJsonEscape: true})),
 *     t.prop('ts', t.num, {format: 'u64'}),
 *     t.prop('cid', t.String({format: 'ascii', noJsonEscape: true})),
 *     t.prop('prid', t.String({format: 'ascii', noJsonEscape: true})),
 *     t.prop('slug', t.String({format: 'ascii', noJsonEscape: true})),
 *     t.prop('name', t.str, {isOptional: true}),
 *     t.prop('src', t.str, {isOptional: true}),
 *     t.prop('doc', t.str, {isOptional: true}),
 *     t.prop('authz', t.str, {isOptional: true}),
 *     t.prop('active', t.bool),
 *   )),
 *   t.prop('block', t.Object(
 *     t.prop('id', t.String({format: 'ascii', noJsonEscape: true})),
 *     t.prop('ts', t.num, {format: 'u64'}),
 *     t.prop('cid', t.String({format: 'ascii', noJsonEscape: true})),
 *     t.prop('slug', t.String({format: 'ascii', noJsonEscape: true})),
 *   )),
 * );
 * ```
 *
 * @module
 */
 
export * from './constants';
export * from './schema';
export * from './type';
export * from './value';