Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function clone(value: any, type: AnySSZType): any {
const _type = parseType(type);
_assertValidValue(value, _type);
return _clone(value, _type);
}
export function fromJson(value: object, type: AnySSZType): T {
value = objectToCamelCase(value);
return expandJsonValue(value, parseType(type));
}
export function serialize(value: any, type: AnySSZType): Buffer {
const _type = parseType(type);
_assertValidValue(value, _type);
const buf = Buffer.alloc(size(value, _type));
_serialize(value, _type, buf, 0);
return buf;
}
export function defaultValue(type: AnySSZType): T {
return _defaultValue(parseType(type)) as T;
}
export function createValue(type: AnySSZType, value: any = null): T {
return _createValue(parseType(type), value) as T;
}
export function equals(value1: any, value2: any, type: AnySSZType): boolean {
const _type = parseType(type);
_assertValidValue(value1, _type);
_assertValidValue(value2, _type);
return _equals(value1, value2, _type);
}