Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 1.43 KB

README.md

File metadata and controls

38 lines (33 loc) · 1.43 KB

Domain Name Util test codecov

Domain name utility functions for Node.

Installation

npm install domain-name-util

Usage

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)