Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vikpe/domain-name-util
Domain name utility functions for Node.
https://github.com/vikpe/domain-name-util
domain-names domains javascript nodejs utility
Last synced: 26 days ago
JSON representation
Domain name utility functions for Node.
- Host: GitHub
- URL: https://github.com/vikpe/domain-name-util
- Owner: vikpe
- License: mit
- Created: 2017-11-12T18:16:59.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T07:02:49.000Z (about 1 year ago)
- Last Synced: 2024-10-05T22:36:20.388Z (about 1 month ago)
- Topics: domain-names, domains, javascript, nodejs, utility
- Language: JavaScript
- Homepage:
- Size: 1.81 MB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Domain Name Util [![test](https://github.com/vikpe/domain-name-util/workflows/test/badge.svg)](https://github.com/vikpe/domain-name-util/actions?query=workflow%3Atest) [![codecov](https://codecov.io/gh/vikpe/domain-name-util/branch/master/graph/badge.svg)](https://codecov.io/gh/vikpe/domain-name-util)
> Domain name utility functions for Node.## Installation
```bash
npm install domain-name-util
```## Usage
```javascript
import domainNameUtil from 'domain-name-util';domainNameUtil.containsAlphabetics('foo.com'); // true
domainNameUtil.containsNumerics('foo.com'); // false
domainNameUtil.getBaseLevelDomain('foo.com'); // 'foo'
domainNameUtil.getDomains('foo.com'); // ['foo', 'com']
domainNameUtil.getLength('foo.com'); // 3
domainNameUtil.getTopLevelDomain('foo.com'); // 'com'
domainNameUtil.isAlphabetic('foo.com'); // true
domainNameUtil.isHyphenated('foo.com'); // false
domainNameUtil.isNumeric('foo.com'); // false
domainNameUtil.isSubdomain('foo.com'); // false
domainNameUtil.matchesRegExp('foo.com', /foo/); // true
```## API
* `containsAlphabetics(domainName)`
* `containsNumerics(domainName)`
* `getBaseLevelDomain(domainName)`
* `getDomains(domainName)`
* `getLength(domainName)`
* `getTopLevelDomain(domainName)`
* `isAlphabetic(domainName)`
* `isHyphenated(domainName)`
* `isNumeric(domainName)`
* `isSubdomain(domainName)`
* `matchesRegExp(domainName, regExp)`