Skip to content

Commit fe3c276

Browse files
committed
refactor: use Americian English
1 parent d4ae392 commit fe3c276

File tree

11 files changed

+106
-105
lines changed

11 files changed

+106
-105
lines changed

CODE_OF_CONDUCT.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ diverse, inclusive, and healthy community.
1414

1515
## Our Standards
1616

17-
Examples of behaviour that contributes to a positive environment for our
17+
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

2020
- Demonstrating empathy and kindness toward other people
@@ -25,9 +25,9 @@ community include:
2525
- Focusing on what is best not just for us as individuals, but for the
2626
overall community
2727

28-
Examples of unacceptable behaviour include:
28+
Examples of unacceptable behavior include:
2929

30-
- The use of sexualied language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3131
advances of any kind
3232
- Trolling, insulting or derogatory comments, and personal or political attacks
3333
- Public or private harassment
@@ -39,8 +39,8 @@ Examples of unacceptable behaviour include:
3939
## Enforcement Responsibilities
4040

4141
Community leaders are responsible for clarifying and enforcing our standards of
42-
acceptable behaviour and will take appropriate and fair corrective action in
43-
response to any behaviour that they deem inappropriate, threatening, offensive,
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
4444
or harmful.
4545

4646
Community leaders have the right and responsibility to remove, edit, or reject
@@ -58,7 +58,7 @@ representative at an online or offline event.
5858

5959
## Enforcement
6060

61-
Instances of abusive, harassing, or otherwise unacceptable behaviour may be
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at alvis@hilbert.space.
6363
All complaints will be reviewed and investigated promptly and fairly.
6464

@@ -72,19 +72,19 @@ the consequences for any action they deem in violation of this Code of Conduct:
7272

7373
### 1. Correction
7474

75-
**Community Impact**: Use of inappropriate language or other behaviour deemed
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
7676
unprofessional or unwelcome in the community.
7777

7878
**Consequence**: A private, written warning from community leaders, providing
7979
clarity around the nature of the violation and an explanation of why the
80-
behaviour was inappropriate. A public apology may be requested.
80+
behavior was inappropriate. A public apology may be requested.
8181

8282
### 2. Warning
8383

8484
**Community Impact**: A violation through a single incident or series
8585
of actions.
8686

87-
**Consequence**: A warning with consequences for continued behaviour. No
87+
**Consequence**: A warning with consequences for continued behavior. No
8888
interaction with the people involved, including unsolicited interaction with
8989
those enforcing the Code of Conduct, for a specified period of time. This
9090
includes avoiding interactions in community spaces as well as external channels
@@ -94,7 +94,7 @@ permanent ban.
9494
### 3. Temporary Ban
9595

9696
**Community Impact**: A serious violation of community standards, including
97-
sustained inappropriate behaviour.
97+
sustained inappropriate behavior.
9898

9999
**Consequence**: A temporary ban from any sort of interaction or public
100100
communication with the community for a specified period of time. No public or
@@ -105,7 +105,7 @@ Violating these terms may lead to a permanent ban.
105105
### 4. Permanent Ban
106106

107107
**Community Impact**: Demonstrating a pattern of violation of community
108-
standards, including sustained inappropriate behaviour, harassment of an
108+
standards, including sustained inappropriate behavior, harassment of an
109109
individual, or aggression toward or disparagement of classes of individuals.
110110

111111
**Consequence**: A permanent ban from any sort of public interaction within

source/client.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class Notion {
147147
...body,
148148
title: body.title.map((text) => text.plain_text).join(''),
149149
pages: await Promise.all(
150-
pages.map(this.normalisePageAndCache.bind(this)),
150+
pages.map(this.normalizePageAndCache.bind(this)),
151151
),
152152
};
153153
}
@@ -167,7 +167,7 @@ export class Notion {
167167
{ ttl: this.ttl.pageMeta },
168168
);
169169

170-
return this.normalisePageAndCache(body);
170+
return this.normalizePageAndCache(body);
171171
}
172172

173173
/**
@@ -241,7 +241,7 @@ export class Notion {
241241
* @param page the page object returned from Notion API
242242
* @returns page with title and its content
243243
*/
244-
private async normalisePage(page: Page): Promise<FullPage> {
244+
private async normalizePage(page: Page): Promise<FullPage> {
245245
// NOTE: API calls will be made for getting blocks as no cache will be set
246246
const blocks = await this.getBlocks(page.id);
247247
// Name for a page in a database, title for an ordinary page
@@ -274,11 +274,11 @@ export class Notion {
274274
}
275275

276276
/**
277-
* normalised a page, or get it from the cache
277+
* normalized a page, or get it from the cache
278278
* @param page the page object returned from Notion API
279279
* @returns page with title and its content
280280
*/
281-
private async normalisePageAndCache(page: Page): Promise<FullPage> {
281+
private async normalizePageAndCache(page: Page): Promise<FullPage> {
282282
const cacheKey = `page:${page.id}:content`;
283283
const cachedPage = await this.cache.get<FullPage>(cacheKey);
284284

@@ -290,16 +290,16 @@ export class Notion {
290290
) {
291291
return cachedPage;
292292
} else {
293-
const normalisedPage = await this.normalisePage(page);
293+
const normalizedPage = await this.normalizePage(page);
294294
await this.cache.set(
295295
cacheKey,
296-
normalisedPage,
296+
normalizedPage,
297297
// NOTE: by default the cache would last forever and
298298
// therefore no API call will be make unless the last_edit_time has changed
299299
{ ttl: this.ttl.pageContent },
300300
);
301301

302-
return normalisedPage;
302+
return normalizedPage;
303303
}
304304
}
305305
}

source/gatsby-node.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import { version as gatsbyVersion } from 'gatsby/package.json';
1717

1818
import { name } from '#.';
19-
import { computePreviewUpdateInterval, normaliseConfig, sync } from '#plugin';
19+
import { computePreviewUpdateInterval, normalizeConfig, sync } from '#plugin';
2020

2121
import type { GatsbyNode } from 'gatsby';
2222

@@ -56,32 +56,33 @@ export const onPreBootstrap: NonNullable<GatsbyNode['onPreBootstrap']> = async (
5656
}
5757
};
5858

59-
export const onCreateDevServer: NonNullable<GatsbyNode['onCreateDevServer']> =
60-
async (args, partialConfig) => {
61-
const pluginConfig = normaliseConfig(partialConfig);
62-
const { previewCallRate } = pluginConfig;
59+
export const onCreateDevServer: NonNullable<
60+
GatsbyNode['onCreateDevServer']
61+
> = async (args, partialConfig) => {
62+
const pluginConfig = normalizeConfig(partialConfig);
63+
const { previewCallRate } = pluginConfig;
6364

64-
const previewUpdateInterval = computePreviewUpdateInterval(pluginConfig);
65-
if (previewCallRate && previewUpdateInterval) {
66-
const scheduleUpdate = (): NodeJS.Timeout =>
67-
setTimeout(async () => {
68-
// sync entities from notion
69-
await sync(args, pluginConfig);
65+
const previewUpdateInterval = computePreviewUpdateInterval(pluginConfig);
66+
if (previewCallRate && previewUpdateInterval) {
67+
const scheduleUpdate = (): NodeJS.Timeout =>
68+
setTimeout(async () => {
69+
// sync entities from notion
70+
await sync(args, pluginConfig);
7071

71-
// schedule the next update
72-
scheduleUpdate();
73-
}, previewUpdateInterval);
72+
// schedule the next update
73+
scheduleUpdate();
74+
}, previewUpdateInterval);
7475

75-
scheduleUpdate();
76-
}
77-
};
76+
scheduleUpdate();
77+
}
78+
};
7879

7980
export const sourceNodes: NonNullable<GatsbyNode['sourceNodes']> = async (
8081
args,
8182
partialConfig,
8283
) => {
8384
// sync entities from notion
84-
await sync(args, normaliseConfig(partialConfig));
85+
await sync(args, normalizeConfig(partialConfig));
8586
};
8687

8788
/* eslint-enable */

source/node.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface Link {
3434
}
3535

3636
type FullEntity = FullDatabase | FullPage;
37-
type NormalisedEntity<E extends FullEntity = FullEntity> = E extends any
37+
type NormalizedEntity<E extends FullEntity = FullEntity> = E extends any
3838
? Omit<E, 'parent'> & {
3939
parent: Link | null;
4040
children: Link[];
@@ -207,7 +207,7 @@ export class NodeManager {
207207
* @returns a database node
208208
*/
209209
private createDatabaseNode(
210-
database: NormalisedEntity<FullDatabase>,
210+
database: NormalizedEntity<FullDatabase>,
211211
): ContentNode<'NotionDatabase'> {
212212
return this.createBaseNode(database, { type: 'NotionDatabase' });
213213
}
@@ -218,7 +218,7 @@ export class NodeManager {
218218
* @returns a page node
219219
*/
220220
private createPageNode(
221-
page: NormalisedEntity<FullPage>,
221+
page: NormalizedEntity<FullPage>,
222222
): ContentNode<'NotionPage'> {
223223
return this.createBaseNode(page, {
224224
type: 'NotionPage',
@@ -234,7 +234,7 @@ export class NodeManager {
234234
* @returns a node with common data
235235
*/
236236
private createBaseNode<T extends string>(
237-
entity: NormalisedEntity,
237+
entity: NormalizedEntity,
238238
internal: Omit<NodeInput['internal'], 'contentDigest'> & { type: T },
239239
): ContentNode<T> {
240240
const basis = {
@@ -269,7 +269,7 @@ export class NodeManager {
269269
* @param entity the entity to be converted
270270
* @returns converted entity ready to be consumed by gatsby
271271
*/
272-
private nodifyEntity(entity: NormalisedEntity): NodeInput {
272+
private nodifyEntity(entity: NormalizedEntity): NodeInput {
273273
switch (entity.object) {
274274
case 'database':
275275
return this.createDatabaseNode(entity);
@@ -320,13 +320,13 @@ export function computeChanges(
320320
*/
321321
export function computeEntityMap(
322322
entities: FullEntity[],
323-
): Map<string, NormalisedEntity> {
323+
): Map<string, NormalizedEntity> {
324324
// create a new working set
325-
const map = new Map<string, NormalisedEntity>();
325+
const map = new Map<string, NormalizedEntity>();
326326
for (const entity of entities) {
327327
map.set(`${entity.object}:${entity.id}`, {
328328
...entity,
329-
parent: normaliseParent(entity.parent),
329+
parent: normalizeParent(entity.parent),
330330
children: [],
331331
});
332332
}
@@ -357,7 +357,7 @@ export function computeEntityMap(
357357
* @param parent the parent field returned from Notion API
358358
* @returns information about the parent in an unified format
359359
*/
360-
export function normaliseParent(parent: FullEntity['parent']): Link | null {
360+
export function normalizeParent(parent: FullEntity['parent']): Link | null {
361361
switch (parent.type) {
362362
case 'database_id':
363363
return { object: 'database', id: parent.database_id };

source/plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const DEFAULT_PREVIEW_API_RATE = 2.5;
4646

4747
/**
4848
* compute the update interval for the preview mode
49-
* @param pluginConfig the normalised plugin config
49+
* @param pluginConfig the normalized plugin config
5050
* @returns the number of milliseconds needed between each sync
5151
*/
5252
export function computePreviewUpdateInterval(
@@ -75,7 +75,7 @@ export function computePreviewUpdateInterval(
7575
* @param config pluginConfig passed from the plugin options
7676
* @returns a complete config
7777
*/
78-
export function normaliseConfig(
78+
export function normalizeConfig(
7979
config: Partial<PluginConfig>,
8080
): FullPluginConfig {
8181
const { previewCallRate = DEFAULT_PREVIEW_API_RATE } = config;
@@ -148,7 +148,7 @@ export async function getPages(
148148
}
149149

150150
/**
151-
* synchronise data between Notion and Gatsby
151+
* synchronize data between Notion and Gatsby
152152
* @param args argument passed from Gatsby's Node API
153153
* @param pluginConfig pluginConfig passed from the plugin options
154154
*/

source/property.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ type Date = { start: string; end?: string };
1919

2020
type Person = { name: string; avatar?: string };
2121

22-
type NormalisedValue =
22+
type NormalizedValue =
2323
| undefined
2424
| boolean
2525
| number
2626
| string
2727
| string[]
2828
| Date
2929
| Person
30-
| NormalisedValue[];
30+
| NormalizedValue[];
3131

3232
/* eslint-disable max-lines-per-function */
3333
/**
3434
* extract the content from a property
3535
* @param property a property returned from Notion API
3636
* @returns its content
3737
*/
38-
export function getPropertyContent(property: PropertyValue): NormalisedValue {
38+
export function getPropertyContent(property: PropertyValue): NormalizedValue {
3939
switch (property.type) {
4040
case 'title':
4141
return property.title.map((text) => text.plain_text).join('');
@@ -89,7 +89,7 @@ export function getPropertyContent(property: PropertyValue): NormalisedValue {
8989
*/
9090
function getFormulaPropertyContent(
9191
formula: FormulaValue['formula'],
92-
): NormalisedValue {
92+
): NormalizedValue {
9393
switch (formula.type) {
9494
case 'string':
9595
return formula.string;
@@ -112,7 +112,7 @@ function getFormulaPropertyContent(
112112
*/
113113
function getRollupPropertyContent(
114114
rollup: RollupValue['rollup'],
115-
): NormalisedValue | NormalisedValue[] {
115+
): NormalizedValue | NormalizedValue[] {
116116
switch (rollup.type) {
117117
case 'number':
118118
return rollup.number;

source/types/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type { DateValue } from './property';
1717
import type { User } from './user';
1818

1919
/*
20-
* Colour
20+
* Color
2121
*/
2222

2323
export type Color =

spec/example.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ export const richtext: RichText[] = [
127127
underline: false,
128128
},
129129
href: null,
130-
plain_text: 'colour',
130+
plain_text: 'color',
131131
text: {
132-
content: 'colour',
132+
content: 'color',
133133
link: null,
134134
},
135135
type: 'text',
@@ -1201,7 +1201,7 @@ export const full: FullBlock[] = [
12011201
},
12021202
{
12031203
type: 'text',
1204-
text: { content: 'colour', link: null },
1204+
text: { content: 'color', link: null },
12051205
annotations: {
12061206
bold: false,
12071207
italic: false,
@@ -1210,7 +1210,7 @@ export const full: FullBlock[] = [
12101210
code: false,
12111211
color: 'yellow_background',
12121212
},
1213-
plain_text: 'colour',
1213+
plain_text: 'color',
12141214
href: null,
12151215
},
12161216
],

spec/markdown.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ Toggled Content
314314
315315
@Alvis Tang [gatsby-source-notion](https://www.notion.so/8468103a77ae4b1a8fcda89951c9c007) [Link](https://link)
316316
317-
# _**Annotated**_ ~~_**Heading**_~~ with $x^2$ and colour
317+
# _**Annotated**_ ~~_**Heading**_~~ with $x^2$ and color
318318
319319
# Unsupported
320320

0 commit comments

Comments
 (0)