From 76cb9c2a39d477a64824a985ade40507e3bbade1 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Fri, 13 Feb 2026 21:34:48 -0800 Subject: feat(vanilla): add testing infrastructure and tests (NK-wjnczv) --- .../node_modules/tldts-core/src/domain-without-suffix.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 vanilla/node_modules/tldts-core/src/domain-without-suffix.ts (limited to 'vanilla/node_modules/tldts-core/src/domain-without-suffix.ts') diff --git a/vanilla/node_modules/tldts-core/src/domain-without-suffix.ts b/vanilla/node_modules/tldts-core/src/domain-without-suffix.ts new file mode 100644 index 0000000..9607d4b --- /dev/null +++ b/vanilla/node_modules/tldts-core/src/domain-without-suffix.ts @@ -0,0 +1,14 @@ +/** + * Return the part of domain without suffix. + * + * Example: for domain 'foo.com', the result would be 'foo'. + */ +export default function getDomainWithoutSuffix( + domain: string, + suffix: string, +): string { + // Note: here `domain` and `suffix` cannot have the same length because in + // this case we set `domain` to `null` instead. It is thus safe to assume + // that `suffix` is shorter than `domain`. + return domain.slice(0, -suffix.length - 1); +} -- cgit v1.2.3