UNPKG

@apollo/client

Version:

A fully-featured caching GraphQL client.

32 lines 851 B
export class Scalar { options; static fromGraphQLScalarType(scalarType, options) { return new Scalar({ ...options, parse: scalarType.parseValue, serialize: scalarType.serialize, }); } constructor(options) { this.options = options; } parse(value) { return this.options.parse(value); } serialize(value) { return this.options.serialize(value); } coerceToParsed(value) { return this.is(value) ? value : this.parse(value); } coerceToSerialized(value) { return this.is(value) ? this.serialize(value) : value; } is(value) { if (this.options.is) { return this.options.is(value); } return typeof value === "object" && value !== null; } } //# sourceMappingURL=Scalar.js.map