diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1712ab4..24c5840 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -**Note:** This guide is a work in progress. Feel free to [submit an issue](https://github.com/Hypercontext/linkifyjs/issues/new) if anything is confusing or unclear. +**Note:** This guide is a work in progress. Feel free to [submit an issue](https://github.com/nfrasser/linkifyjs/issues/new) if anything is confusing or unclear. ## How linkify works @@ -14,10 +14,10 @@ The second stage, the parser, takes this array of tokens and aggregates them int A multitoken is either a link or not a link. Core linkify comes with these multitokens -* **`Text`** is plain text (that contains no linkable entities) -* **`Nl`** represents a single newline character -* **`Email`** email address -* **`URL`** +- **`Text`** is plain text (that contains no linkable entities) +- **`Nl`** represents a single newline character +- **`Email`** email address +- **`URL`** The latter two are converted to links. `Nl` is in some cases converted to a `
` HTML tag. @@ -25,8 +25,8 @@ You can use the Token class system to [create plugins](#building-plugins). ## Style -* ES6 Syntax (except tests for now) -* Hard tabs with a width of 4 characters +- ES6 Syntax (except tests for now) +- Hard tabs with a width of 4 characters Keep your changes consistent with what's already there. @@ -56,22 +56,22 @@ This transpiles ES6 to ES5 (via [Babel](http://babeljs.io/)) from `src/` into `d These tools are used for testing linkify: -* [Mocha](https://mochajs.org/) is our primary test case framework -* [ESLint](https://eslint.org) for code linting -* [Istanbul](https://istanbul.js.org/) for code coverage analysis -* [Karma](http://karma-runner.github.io/) is our browser test runner -* [BrowserStack](https://www.browserstack.com) for cross-browser testing +- [Mocha](https://mochajs.org/) is our primary test case framework +- [ESLint](https://eslint.org) for code linting +- [Istanbul](https://istanbul.js.org/) for code coverage analysis +- [Karma](http://karma-runner.github.io/) is our browser test runner +- [BrowserStack](https://www.browserstack.com) for cross-browser testing These are all configured to run in npm scripts. Tasks `npm test` and `npm run lint` are the most basic you can run. Other tasks include: -* `npm run build` converts the `src` ES source code into browser- and Node.js- compatible JavaScript. It also outputs TypeScript definitions. -* `npm run clean` removes all generated files -* `npm run dist` cleans, builds and copies the final browser distribution bundle into the root `dist` directory +- `npm run build` converts the `src` ES source code into browser- and Node.js- compatible JavaScript. It also outputs TypeScript definitions. +- `npm run clean` removes all generated files +- `npm run dist` cleans, builds and copies the final browser distribution bundle into the root `dist` directory ### Building plugins **Caution:** The plugin development API is in its very early stages and only supports very basic plugins. Updated features, APIs, and docs are in the works. -Check out the sample [Hashtag plugin](https://github.com/Hypercontext/linkifyjs/blob/main/packages/linkify-plugin-hashtag/src/hashtag.js) for an example. Check out the [Keyword plugin](https://github.com/Hypercontext/linkifyjs/blob/main/packages/linkify-plugin-keyword/src/keyword.js) for more advanced usage. +Check out the sample [Hashtag plugin](https://github.com/nfrasser/linkifyjs/blob/main/packages/linkify-plugin-hashtag/src/hashtag.js) for an example. Check out the [Keyword plugin](https://github.com/nfrasser/linkifyjs/blob/main/packages/linkify-plugin-keyword/src/keyword.js) for more advanced usage. Register a new plugin with [`linkify.registerPlugin()`](https://linkify.js.org/docs/linkifyjs.html#linkifyregisterplugin-name-plugin). diff --git a/LICENSE b/LICENSE index e9422e7..da1dff9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index a4dc527..3001edf 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Linkify [![npm version](https://badge.fury.io/js/linkifyjs.svg)](https://www.npmjs.com/package/linkifyjs) -[![CI](https://github.com/Hypercontext/linkifyjs/actions/workflows/ci.yml/badge.svg)](https://github.com/Hypercontext/linkifyjs/actions/workflows/ci.yml) +[![CI](https://github.com/nfrasser/linkifyjs/actions/workflows/ci.yml/badge.svg)](https://github.com/nfrasser/linkifyjs/actions/workflows/ci.yml) [![BrowserStack Status](https://automate.browserstack.com/badge.svg?badge_key=ZVZXNFhhQ044a01nQStVeWJXSng1b01MTWFpZlZRZVg1WnAvdE9aVE9LVT0tLWZpekx6ZHUrZ2E0dDRHMDZRMnJNQlE9PQ==--4d91db279fbd0475f8d8e4b221b5a4c1e0c6a76e)](https://automate.browserstack.com/public-build/ZVZXNFhhQ044a01nQStVeWJXSng1b01MTWFpZlZRZVg1WnAvdE9aVE9LVT0tLWZpekx6ZHUrZ2E0dDRHMDZRMnJNQlE9PQ==--4d91db279fbd0475f8d8e4b221b5a4c1e0c6a76e) -[![Coverage Status](https://coveralls.io/repos/github/Hypercontext/linkifyjs/badge.svg?branch=main)](https://coveralls.io/github/Hypercontext/linkifyjs?branch=main) +[![Coverage Status](https://coveralls.io/repos/github/nfrasser/linkifyjs/badge.svg?branch=main)](https://coveralls.io/github/nfrasser/linkifyjs?branch=main) Linkify is a JavaScript plugin. Use Linkify to find links in plain-text and convert them to HTML <a> tags. It automatically highlights URLs, @@ -40,7 +40,7 @@ convert them to HTML <a> tags. It automatically highlights URLs, [View full documentation](https://linkify.js.org/docs/). -Download the [latest release](https://github.com/Hypercontext/linkifyjs/releases) for direct use in the browser, or install via [NPM](https://www.npmjs.com/): +Download the [latest release](https://github.com/nfrasser/linkifyjs/releases) for direct use in the browser, or install via [NPM](https://www.npmjs.com/): ``` npm install linkifyjs linkify-html @@ -150,7 +150,7 @@ supported. ## Downloads -Download the [**latest release**](https://github.com/Hypercontext/linkifyjs/releases) +Download the [**latest release**](https://github.com/nfrasser/linkifyjs/releases) ## API Documentation @@ -158,7 +158,7 @@ View full documentation at [linkify.js.org/docs](https://linkify.js.org/docs/) ## Contributing -Check out [CONTRIBUTING.md](https://github.com/Hypercontext/linkifyjs/blob/main/CONTRIBUTING.md). +Check out [CONTRIBUTING.md](https://github.com/nfrasser/linkifyjs/blob/main/CONTRIBUTING.md). ## License @@ -166,4 +166,4 @@ MIT ## Authors -Linkify is made with ❤️ by [Hypercontext](https://hypercontext.com/) and [@nfrasser](https://github.com/nfrasser) +Linkify is made with ❤️ by [@nfrasser](https://github.com/nfrasser) diff --git a/package.json b/package.json index 7d31369..921d5e2 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Intelligent link recognition, made easy", "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git" + "url": "git+https://github.com/nfrasser/linkifyjs.git" }, "scripts": { "build": "npm run build --workspaces", @@ -26,7 +26,7 @@ "test:ci2": "karma start test/ci2.conf.js --single-run", "tlds": "node tasks/update-tlds.js" }, - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "devDependencies": { "@babel/core": "^7.13.10", diff --git a/packages/linkify-element/LICENSE b/packages/linkify-element/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-element/LICENSE +++ b/packages/linkify-element/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-element/package.json b/packages/linkify-element/package.json index ef63108..1051136 100644 --- a/packages/linkify-element/package.json +++ b/packages/linkify-element/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-element" }, "keywords": [ @@ -23,10 +23,10 @@ "email", "browser" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-html/LICENSE b/packages/linkify-html/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-html/LICENSE +++ b/packages/linkify-html/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-html/package.json b/packages/linkify-html/package.json index 386562e..0ab7998 100644 --- a/packages/linkify-html/package.json +++ b/packages/linkify-html/package.json @@ -14,7 +14,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-html" }, "keywords": [ @@ -23,10 +23,10 @@ "url", "email" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "devDependencies": { diff --git a/packages/linkify-jquery/LICENSE b/packages/linkify-jquery/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-jquery/LICENSE +++ b/packages/linkify-jquery/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-jquery/package.json b/packages/linkify-jquery/package.json index a1da739..068e405 100644 --- a/packages/linkify-jquery/package.json +++ b/packages/linkify-jquery/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-jquery" }, "keywords": [ @@ -24,10 +24,10 @@ "jquery", "browser" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-plugin-hashtag/LICENSE b/packages/linkify-plugin-hashtag/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-plugin-hashtag/LICENSE +++ b/packages/linkify-plugin-hashtag/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-plugin-hashtag/package.json b/packages/linkify-plugin-hashtag/package.json index 0e45c5c..05e9577 100644 --- a/packages/linkify-plugin-hashtag/package.json +++ b/packages/linkify-plugin-hashtag/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-plugin-hashtag" }, "keywords": [ @@ -22,10 +22,10 @@ "url", "email" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-plugin-ip/LICENSE b/packages/linkify-plugin-ip/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-plugin-ip/LICENSE +++ b/packages/linkify-plugin-ip/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-plugin-ip/package.json b/packages/linkify-plugin-ip/package.json index b2cbebb..5de7c20 100644 --- a/packages/linkify-plugin-ip/package.json +++ b/packages/linkify-plugin-ip/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-plugin-ip" }, "keywords": [ @@ -25,10 +25,10 @@ "ipv4", "ipv6" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-plugin-keyword/LICENSE b/packages/linkify-plugin-keyword/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-plugin-keyword/LICENSE +++ b/packages/linkify-plugin-keyword/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-plugin-keyword/package.json b/packages/linkify-plugin-keyword/package.json index 3d06b41..6e1a584 100644 --- a/packages/linkify-plugin-keyword/package.json +++ b/packages/linkify-plugin-keyword/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-plugin-keyword" }, "keywords": [ @@ -23,10 +23,10 @@ "email", "keyword" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-plugin-mention/LICENSE b/packages/linkify-plugin-mention/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-plugin-mention/LICENSE +++ b/packages/linkify-plugin-mention/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-plugin-mention/package.json b/packages/linkify-plugin-mention/package.json index 837992d..addda19 100644 --- a/packages/linkify-plugin-mention/package.json +++ b/packages/linkify-plugin-mention/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-plugin-mention" }, "keywords": [ @@ -22,10 +22,10 @@ "url", "email" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-plugin-ticket/LICENSE b/packages/linkify-plugin-ticket/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-plugin-ticket/LICENSE +++ b/packages/linkify-plugin-ticket/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-plugin-ticket/package.json b/packages/linkify-plugin-ticket/package.json index ae4737a..7f11368 100644 --- a/packages/linkify-plugin-ticket/package.json +++ b/packages/linkify-plugin-ticket/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-plugin-ticket" }, "keywords": [ @@ -22,10 +22,10 @@ "url", "email" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-plugin-ticket/src/ticket.mjs b/packages/linkify-plugin-ticket/src/ticket.mjs index 23acef3..923177c 100644 --- a/packages/linkify-plugin-ticket/src/ticket.mjs +++ b/packages/linkify-plugin-ticket/src/ticket.mjs @@ -6,7 +6,7 @@ const TicketToken = createTokenClass('ticket', { isLink: true }); * @type {import('linkifyjs').Plugin} */ export default function ticket({ scanner, parser }) { - // TODO: Add cross-repo style tickets? e.g., Hypercontext/linkifyjs#42 + // TODO: Add cross-repo style tickets? e.g., nfrasser/linkifyjs#42 // Is that even feasible? const { POUND, groups } = scanner.tokens; diff --git a/packages/linkify-react/LICENSE b/packages/linkify-react/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-react/LICENSE +++ b/packages/linkify-react/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-react/package.json b/packages/linkify-react/package.json index 63c5fcf..4925b71 100644 --- a/packages/linkify-react/package.json +++ b/packages/linkify-react/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-react" }, "keywords": [ @@ -23,10 +23,10 @@ "email", "react" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkify-string/LICENSE b/packages/linkify-string/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkify-string/LICENSE +++ b/packages/linkify-string/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkify-string/package.json b/packages/linkify-string/package.json index 69e4b18..43f6faf 100644 --- a/packages/linkify-string/package.json +++ b/packages/linkify-string/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkify-string" }, "keywords": [ @@ -22,10 +22,10 @@ "url", "email" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org", "peerDependencies": { diff --git a/packages/linkifyjs/LICENSE b/packages/linkifyjs/LICENSE index e9422e7..da1dff9 100644 --- a/packages/linkifyjs/LICENSE +++ b/packages/linkifyjs/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2021 SoapBox Innovations Inc. +Copyright (c) 2024 Nick Frasser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/linkifyjs/package.json b/packages/linkifyjs/package.json index f844fff..bb67f3c 100644 --- a/packages/linkifyjs/package.json +++ b/packages/linkifyjs/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/Hypercontext/linkifyjs.git", + "url": "git+https://github.com/nfrasser/linkifyjs.git", "directory": "packages/linkifyjs" }, "keywords": [ @@ -28,10 +28,10 @@ "twitter", "url" ], - "author": "Hypercontext", + "author": "Nick Frasser (https://nfrasser.com)", "license": "MIT", "bugs": { - "url": "https://github.com/Hypercontext/linkifyjs/issues" + "url": "https://github.com/nfrasser/linkifyjs/issues" }, "homepage": "https://linkify.js.org" } diff --git a/tasks/update-tlds.js b/tasks/update-tlds.js index c6c1d08..d57c353 100644 --- a/tasks/update-tlds.js +++ b/tasks/update-tlds.js @@ -3,10 +3,9 @@ const fs = require('fs'); const punycode = require('punycode/'); const tldsListUrl = 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt'; -const tldsjs = 'packages/linkifyjs/src/tlds.js'; +const tldsjs = 'packages/linkifyjs/src/tlds.mjs'; let tldsListContents = ''; - /** * Given a list of TLDs, encodes into a compact string that may be decoded * with decodeTlds. Works best when input is sorted alphabetically @@ -52,7 +51,6 @@ function createTrie(words) { return root; } - /** * Given an object trie created by `createTrie`, encodes into a compact string * that can later be decoded back into a list of strings. @@ -117,7 +115,9 @@ function decodeTlds(encoded) { http.get(tldsListUrl, (response) => { console.log(`Downloading ${tldsListUrl}...`); - response.on('data', (chunk) => { tldsListContents += chunk; }); + response.on('data', (chunk) => { + tldsListContents += chunk; + }); response.on('end', () => { console.log(`Downloaded. Re-generating ${tldsjs}...`); @@ -131,10 +131,12 @@ http.get(tldsListUrl, (response) => { // they're the only ones that contain a mix of ASCII and non-ASCII // characters. const specialTlds = ['XN--VERMGENSBERATER-CTB', 'XN--VERMGENSBERATUNG-PWB']; - const specialUtlds = specialTlds.map(tld => punycode.toUnicode(tld.toLowerCase())); + const specialUtlds = specialTlds.map((tld) => punycode.toUnicode(tld.toLowerCase())); - for (const line of tldsListContents.split('\n').map(line => line.trim())) { - if (!line || line[0] === '#' || specialTlds.includes(line)) { continue; } + for (const line of tldsListContents.split('\n').map((line) => line.trim())) { + if (!line || line[0] === '#' || specialTlds.includes(line)) { + continue; + } if (/^XN--/.test(line)) { utlds.push(punycode.toUnicode(line.toLowerCase())); } else { @@ -158,13 +160,13 @@ http.get(tldsListUrl, (response) => { fs.writeSync(jsFile, `// ${tldsListUrl}\n`); // Write TLDs - fs.writeSync(jsFile, 'export const encodedTlds = \''); + fs.writeSync(jsFile, "export const encodedTlds = '"); fs.writeSync(jsFile, encodedTlds); - fs.writeSync(jsFile, '\';\n'); + fs.writeSync(jsFile, "';\n"); fs.writeSync(jsFile, '// Internationalized domain names containing non-ASCII\n'); - fs.writeSync(jsFile, 'export const encodedUtlds = \''); + fs.writeSync(jsFile, "export const encodedUtlds = '"); fs.writeSync(jsFile, encodedUtlds); - fs.writeSync(jsFile, '\';\n'); + fs.writeSync(jsFile, "';\n"); fs.closeSync(jsFile); console.log('Done');