MCPcopy
hub / github.com/graphql/graphql-js / constructor

Method constructor

src/language/source.ts:54–71  ·  view source on GitHub ↗

* Creates a Source instance. * @param body - The GraphQL source text. * @param name - Name used in diagnostics for this source. * @param locationOffset - One-indexed line and column where this source begins. * @example * ```ts * import { Source } from 'graphql/language'; * *

(
    body: string,
    name: string = 'GraphQL request',
    locationOffset: Location = { line: 1, column: 1 },
  )

Source from the content-addressed store, hash-verified

52 * ```
53 */
54 constructor(
55 body: string,
56 name: string = 'GraphQL request',
57 locationOffset: Location = { line: 1, column: 1 },
58 ) {
59 this.__kind = sourceSymbol;
60 this.body = body;
61 this.name = name;
62 this.locationOffset = locationOffset;
63 devAssert(
64 this.locationOffset.line > 0,
65 'line in locationOffset is 1-indexed and must be positive.',
66 );
67 devAssert(
68 this.locationOffset.column > 0,
69 'column in locationOffset is 1-indexed and must be positive.',
70 );
71 }
72
73 /**
74 * Returns the value used by `Object.prototype.toString`.

Callers

nothing calls this directly

Calls 1

devAssertFunction · 0.90

Tested by

no test coverage detected