From 2c93fa3d7f280e8acf2e7193620bcff1f4cacd31 Mon Sep 17 00:00:00 2001 From: doughlass <38209263+doughlass@users.noreply.github.com> Date: Tue, 5 Apr 2022 22:02:55 +0100 Subject: [PATCH 1/3] chore: additional domain suffixes added for GB locale (#253) --- src/locales/en_GB/internet/domain_suffix.ts | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/locales/en_GB/internet/domain_suffix.ts b/src/locales/en_GB/internet/domain_suffix.ts index 4ef54a67512..d6de8904c55 100644 --- a/src/locales/en_GB/internet/domain_suffix.ts +++ b/src/locales/en_GB/internet/domain_suffix.ts @@ -1 +1,21 @@ -export default ['co.uk', 'com', 'biz', 'info', 'name']; +export default [ + 'ac.uk', + 'biz', + 'co', + 'co.uk', + 'com', + 'cymru', + 'gov.uk', + 'info', + 'london', + 'ltd.uk', + 'me.uk', + 'name', + 'nhs.uk', + 'org.uk', + 'plc.uk', + 'sch.uk', + 'scot', + 'uk', + 'wales', +]; From 28f49466eb9d76a6a96ed34a8d463ecb030bdf79 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 5 Apr 2022 23:14:26 +0200 Subject: [PATCH 2/3] chore: simplify lorem.sentences() (#784) --- src/lorem.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lorem.ts b/src/lorem.ts index 39ce9d3f73f..9a4f9e04ae8 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -101,13 +101,10 @@ export class Lorem { * // 'Et rerum a unde tempora magnam sit nisi. * // Et perspiciatis ipsam omnis.' */ - sentences(sentenceCount?: number, separator?: string): string { + sentences(sentenceCount?: number, separator: string = ' '): string { if (sentenceCount == null) { sentenceCount = this.faker.datatype.number({ min: 2, max: 6 }); } - if (separator == null) { - separator = ' '; - } const sentences: string[] = []; for (sentenceCount; sentenceCount > 0; sentenceCount--) { sentences.push(this.faker.lorem.sentence()); From 6a2d8fce89e0b46f7b9693a7b1f697c108e8af04 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 5 Apr 2022 23:25:45 +0200 Subject: [PATCH 3/3] fix: use `\n` as default separator for lorem.paragraphs() (#783) --- src/lorem.ts | 5 ++--- test/lorem.spec.ts | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lorem.ts b/src/lorem.ts index 9a4f9e04ae8..a605aa2f743 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -131,7 +131,7 @@ export class Lorem { * Generates the given number of paragraphs. * * @param paragraphCount The number of paragraphs to generate. Defaults to `3`. - * @param separator The separator to use. Defaults to `'\n \r'`. + * @param separator The separator to use. Defaults to `'\n'`. * * @example * faker.lorem.paragraphs() @@ -150,8 +150,7 @@ export class Lorem { * // 'Eos magnam aut qui accusamus. Sapiente quas culpa totam excepturi. Blanditiis totam distinctio occaecati dignissimos cumque atque qui officiis.
* // Nihil quis vel consequatur. Blanditiis commodi deserunt sunt animi dolorum. A optio porro hic dolorum fugit aut et sint voluptas. Minima ad sed ipsa est non dolores.' */ - // TODO ST-DDT 2022-02-09: The separator looks odd. - paragraphs(paragraphCount: number = 3, separator: string = '\n \r'): string { + paragraphs(paragraphCount: number = 3, separator: string = '\n'): string { const paragraphs: string[] = []; for (paragraphCount; paragraphCount > 0; paragraphCount--) { paragraphs.push(this.faker.lorem.paragraph()); diff --git a/test/lorem.spec.ts b/test/lorem.spec.ts index 2ceb670f3b6..1f2dbc5b22f 100644 --- a/test/lorem.spec.ts +++ b/test/lorem.spec.ts @@ -19,7 +19,7 @@ const seededRuns = [ 'Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem. Ut quisquam fugiat.', 'Alias sit asperiores sit. Corporis laborum cupiditate consequatur et voluptatem nostrum. Laborum in eos quae nostrum aut consequatur. Blanditiis sunt repellendus et. Eum sint voluptatibus deserunt. Quae eos est soluta ipsum qui.', 'Hic earum delectus. Consequatur eum corporis perferendis aspernatur incidunt nobis. Odio nobis quia est.', - ].join('\n \r'), + ].join('\n'), text: 'Hic sit minus dolor animi mollitia sequi ducimus sequi.', lines: [ 'Hic sit minus dolor animi mollitia sequi ducimus sequi.', @@ -42,7 +42,7 @@ const seededRuns = [ 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur. Voluptatibus nesciunt dignissimos eos temporibus temporibus autem consequatur.', 'Esse vel qui occaecati omnis quis. Voluptatum quis et libero. Et odio dolor qui velit qui. Eveniet provident non fugiat.', 'A a aut nihil. Quas eligendi excepturi eligendi perferendis quo minus et asperiores. Neque blanditiis consequuntur esse autem harum eligendi aut. Cum consequatur pariatur. Omnis temporibus sapiente.', - ].join('\n \r'), + ].join('\n'), text: 'natus nesciunt non', lines: [ 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem.', @@ -66,7 +66,7 @@ const seededRuns = [ 'Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut.', 'In ullam quia impedit. Occaecati repudiandae ut maiores pariatur enim. Deserunt voluptatem in enim in quia.', 'Ut eligendi tempora eos ipsa cumque nulla. Quidem et sed voluptate et quia. Nulla esse in similique deleniti beatae eaque.', - ].join('\n \r'), + ].join('\n'), text: [ 'Omnis tempora magni repellat eaque tempore nesciunt nobis non voluptas.', 'Ex neque eligendi placeat vel perferendis.', @@ -320,7 +320,7 @@ describe('lorem', () => { expect(actual).toBeTypeOf('string'); expect(actual[actual.length - 1]).toBe('.'); - const paragraphs = actual.split('\n \r'); + const paragraphs = actual.split('\n'); expect(paragraphs).toHaveLength(paragraphCount); });