INNER CODE UNIT · TypeScript
millisecondsToSeconds
ravangen/graphql-rate-limit · src/index.ts:157
export function millisecondsToSeconds(duration: number): number {
return Math.ceil(duration / 1000); // round up to over estimate for client
}
/**
* Human readable string that uniquely identifies a schema element within a GraphQL Schema.
* @param info Holds field-specific information relevant to the current operation as well as the schema details.
*/
export function getSchemaCoordinate(info: GraphQLResolveInfo): string {
return `${info.parentType.name}.${info.fieldName}`;
}
/**
* Get a value to uniquely identify a field in a schema.
* @param directiveArgs The arguments defined in the schema for the directive.
* @param source The previous result returned from the resolver on the parent field.
* @param args The arguments provided to the field in the GraphQL operation.
* @param context Contains per-request state shared by all resolvers in a particular operation.