All files / json-type/src/value util.ts

57.14% Statements 4/7
0% Branches 0/1
0% Functions 0/1
66.66% Lines 4/6

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  36x 36x   36x     36x        
import type * as classes from '../type';
import {ObjValue} from './ObjValue';
import {Value} from './Value';
 
export const value: {
  <T extends classes.ObjType>(type: T, data: unknown): ObjValue<T>;
  <T extends classes.Type>(type: T, data: unknown): Value<T>;
} = (type: any, data: any): any => {
  Iif (type.kind() === 'obj') return new ObjValue(type as classes.ObjType, <any>data);
  return new Value(<any>data, type as classes.Type);
};