Skip to content

iamstarkov/group-links-by-domain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

group-links-by-domain

NPM version Build Status Coveralls Status Dependency Status

group links by domain

Install

npm install --save group-links-by-domain

Usage

import domainLinks from 'group-links-by-domain';

const links = [
  'http://what.ever/a/',
  'http://what.ever/b/',
  'http://www.what.ever/c/',
  'http://foo.bar/1/',
  'http://www.foo.bar/1/',
  'http://foo.bar/2/',
  'http://foo.bar/3/',
  'http://www.baz.com/boo/',
];

domainLinks(links); /* [
  { domain: 'what.ever',
    links: [
      'http://what.ever/a/',
      'http://what.ever/b/',
      'http://what.ever/c/' ]},
  { domain: 'foo.bar',
    links: [
      'http://foo.bar/1/',
      'http://foo.bar/2/',
      'http://foo.bar/3/' ]},
  { domain: 'www.baz.com',
    links: [
      'http://www.baz.com/boo/' ]}
]; */

License

MIT © Vladimir Starkov

About

group links by domain

Resources

Stars

Watchers

Forks

Packages

No packages published