Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 831 Bytes

README.md

File metadata and controls

50 lines (39 loc) · 831 Bytes

host-pattern

Install

npm install --save host-pattern

Usage

expand

const hostPattern = require('host-pattern');

// Lists (comma-separated):
hostPattern.expand('example.net,www.host.com');
// [
//   "example.net",
//   "www.host.com"
// ]

// Ranges:
hostPattern.expand('my-host<1,3-5>.example.com');
// [
//   "my-host1.example.com",
//   "my-host3.example.com",
//   "my-host4.example.com",
//   "my-host5.example.com"
// ]

abbreviate

const hostPattern = require('host-pattern');

// Lists (comma-separated):
hostPattern.abbreviate([ 'example.net', 'www.host.com' ]);
// 'example.net,www.host.com'

// Ranges:
hostPattern.abbreviate([
  'my-host1.example.com',
  'my-host3.example.com',
  'my-host4.example.com',
  'my-host5.example.com',
]);
// 'my-host<1,3-5>.example.com'