{"id":22793651,"url":"https://github.com/cmtt/publicsuffixlist","last_synced_at":"2025-04-17T00:50:08.057Z","repository":{"id":47935971,"uuid":"2488261","full_name":"cmtt/publicsuffixlist","owner":"cmtt","description":"A validator for domain names and top level domains, driven by publicsuffixlist.org and ICANN's generic TLDs.","archived":false,"fork":false,"pushed_at":"2022-12-10T10:12:30.000Z","size":762,"stargazers_count":55,"open_issues_count":9,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T05:51:12.250Z","etag":null,"topics":["javascript","publicsuffix","publicsuffixlist"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmtt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-09-30T09:45:23.000Z","updated_at":"2025-03-24T07:54:01.000Z","dependencies_parsed_at":"2023-01-26T05:46:24.073Z","dependency_job_id":null,"html_url":"https://github.com/cmtt/publicsuffixlist","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fpublicsuffixlist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fpublicsuffixlist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fpublicsuffixlist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmtt%2Fpublicsuffixlist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmtt","download_url":"https://codeload.github.com/cmtt/publicsuffixlist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249294711,"owners_count":21245992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","publicsuffix","publicsuffixlist"],"created_at":"2024-12-12T03:28:09.907Z","updated_at":"2025-04-17T00:50:08.040Z","avatar_url":"https://github.com/cmtt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"PublicSuffixList\n================\n\n\u003cdiv\u003e\n  \u003ca href=\"https://travis-ci.org/cmtt/publicsuffixlist\"\u003e\n    \u003cimg src=\"https://img.shields.io/travis/cmtt/publicsuffixlist/master.svg?style=flat-square\" alt=\"Build Status\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.org/package/publicsuffixlist\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/publicsuffixlist.svg?style=flat-square\" alt=\"npm version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"http://spdx.org/licenses/MIT\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/publicsuffixlist.svg?style=flat-square\" alt=\"npm licence\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/cmtt/publicsuffixlist\"\u003e\n    \u003cimg src=\"https://img.shields.io/coveralls/cmtt/publicsuffixlist/master.svg?style=flat-square\" alt=\"Code coverage\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\nA JavaScript domain name parser for the validation of domain names and top level\ndomains, making use of the [Public Suffix List](http://www.publicsuffix.org)\nused internally by modern web browsers.\n\n## Installation\n\nThe ``publicsuffixlist`` module can be installed via npm:\n\n```js\nnpm install publicsuffixlist -S\n```\n\nA current copy of Mozilla's Public Suffix List will be downloaded automatically.\n\n## Updating the list\n\nIn order to obtin a fresh copy of the current list, run ``npm run update`` in\nthe installation folder, usually ``node_modules/publicsuffixlist`` (relative to\nthe project directory).\n\n## Running the unit tests\n\nPlease download and install the [Mocha](http://mochajs.org) test framework\nglobally (you might need to have superuser rights):\n\n```bash\nnpm install mocha -g\n```\n\nThen run the following command:\n\n```bash\nmocha\n```\n\n## Usage\n\n```js\nvar PublicSuffixList = require('publicsuffixlist');\n\n// Create a new PublicSuffixList instance\nvar psl = new PublicSuffixList(options);\n\npsl.initialize(function (err) { // initialize psl asynchronously or\n  // Use the methods described below\n});\n\npsl.initializeSync(); // initialize psl synchronously\n// Use the methods described below\n\n```\n\n### Options\n\n##### ``filename {string}``\nSupplies a filename as source for the data file.\nThis will be Mozilla's \"effective_tld_names.dat\" by default.\n\n##### ``buffer {object}``\nSupplies a buffer as source for the data file.\n\n##### ``lines {string[]}``\nSupplies an array of strings as source for the data file.\n\n### Initialization\n\n##### ``.initialize(callback)``\nLoads all rules from the specified source.\n\n##### ``.initializeSync()``\nLoads all rules synchronously from the specified source.\n\nIn order to use this module, it must be initialized synchronously or\nasynchronously with a ruleset.\nBy default, the ruleset is loaded from disk.\n\n### Methods\n\n##### ``.lookup(domainString)``\nlookup() returns an object providing the distinct results for the queried\nstring or null in case of an invalid query.\n\n```js\nvar result = psl.lookup('www.domain.com');\n\n/* result === { domain: 'domain',\n              tld: 'com',\n              subdomain: 'www' } */\n```\n\n##### ``.domain(domainString)``\n\nGet the assignable domain from the fully qualified domain name.\n\n```js\nvar result = psl.domain('www.domain.com');\n\n/* result === 'domain.com' */\n```\n\n##### ``.validateTLD (tld)``\n\nValidates the provided top level domain. Returns true or false.\n\n```js\nvar validTLD = psl.validateTLD('de'); // true\nvar invalidTLD = psl.validateTLD('ed'); // false\n```\n\n##### ``.validate (domainString)``\n\nReturns true when the provided domain is valid, otherwise false.\n\n```js\nvar validDomain = psl.validate('domain.de'); // true\nvar invalidDomain = psl.validate('domain.yz'); // false\n```\n\n## Manual installation\n\nFor development purposes, you can also clone this repository. Then, you'll\nneed to install all dependencies via ```npm install```.\n\nWhen installing in production (```npm install --only=production```), additional\ndependencies required for running unit tests won't be installed.\n\nAfter a manual installation, it is necessary to run the download_list.js script\nin the root folder in order to download a current version of the list.\n\n## Tests\n\nTests are included in the test/ directory. In order to run these, you will need\nto install the Mocha testing framework and execute the following command:\n\n```bash\nmocha\n# - or -\ngulp mocha\n```\n\n# Further reading\n* [publicsuffix.org](http://www.publicsuffix.org)\n* [Mozilla Wiki: Public Suffix List](https://wiki.mozilla.org/Public_Suffix_List)\n\n# Credits\n* [Kristof Csillag](https://github.com/csillag) disabled certificate validation\n  while installing due to an temporary issue with publicsuffix.org's SSL\n  certificate\n* [Kirill Dmitrenko](https://github.com/dmikis) added loading Mozilla's public\n  suffix list by default (if nothing else was declared)\n* [Morton Swimmer](https://github.com/mswimmer) forked this library, added\n  a .domain() method and updated the URL of the list\n* [Simone Carletti](http://www.simonecarletti.com/code/public_suffix_service/)\n* domainname-parser.googlecode.com\n\n# License\n\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmtt%2Fpublicsuffixlist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmtt%2Fpublicsuffixlist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmtt%2Fpublicsuffixlist/lists"}