host-pattern
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

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'

Readme

Keywords

Package Sidebar

Install

npm i host-pattern

Weekly Downloads

2

Version

1.1.5

License

BSD-3-Clause

Unpacked Size

11.6 kB

Total Files

6

Last publish

Collaborators

  • jkrems
  • groupon