Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@xdanangelxoqenpm/ducimus-repellat-iste

xdanangelxoqenpm232MIT1.0.0

Donate

scheme-validation, Microsoft, curried, callbound, find, equality, break, tape, sharedarraybuffer, deep-copy, ES2018, time, resolve, CSS, ava, parent, japanese, wait, Array.prototype.findLast, styled-components, cache, performance, drag, input, omit, array, batch, ES2019, emoji, react-testing-library, RFC-6455, Float32Array, dom-testing-library, cmd, escape, libphonenumber, trimRight, 6to5, animation, plugin, higher-order, assertion, Observables, codes, byte, exit-code, ECMAScript 6, fsevents, enumerable, preserve-symlinks, promises, tacit, visual, vest, description, Array.prototype.findLastIndex, hash, HyBi, symlink, ES3, trimEnd, weakmap, jasmine, byteLength, crypt, width, TypeBox, readable, rgb, command, qs, watchFile, stream, compare, ES2023, concatMap, three, util.inspect, zod, watcher, ArrayBuffer, get, buffer, iteration, stable, compile less, babel-core, gradients css3, class-validator, figlet, serialization, config, operating-system, inference, picomatch, progress, less, ES2021, getopt, ESnext, ajax, typescript, es7, npm, ECMAScript 2021, jsdom, mocha, log, ratelimit, generics, serialize, less mixins, io-ts, check, signal, lint, byteOffset, logger, object, Symbol, slot, less.js, colors, l10n, bluebird, typed array, validation, sanitize, json-schema-validation, length, which, stateless, korean, hookform, property, code points, move, sameValueZero, mobile, Object.entries, Uint8ClampedArray, callback, Reflect.getPrototypeOf, eslintplugin, random, _.extend, runtime, setter, ECMAScript 2020, toStringTag, tools, json, ES8, Array.prototype.includes, connect, invariant, dataview, cors, jsx, quote, karma, arraybuffer, es, asserts, fs, private data, tdd, properties, mkdirp, match, argparse, sanitization, mimetypes, point-free, auth, eslintconfig, has, find-up, positive, website, trim, preprocessor, symlinks, browserslist, start, chinese, awesomesauce, types, term, format, css less, client, rmdir, airbnb, assert, valid, column, variables in css, rm -fr, ES2022, Int32Array, look-up, eventEmitter, parse, cli, streams2, ES6, accessor, irq, query, up, Int8Array, wget, superagent, mru, fantasy-land, internal, ansi, getintrinsic, joi, datastructure, concat, middleware, getPrototypeOf, WebSocket, indicator, package.json, idle, package, immutable, dir, mime, offset, exit, bundler, Object.values, eslint-plugin, symbol, schema, nodejs, censor, xdg-open, entries, limit, private, tap, weakset, reuse, URLSearchParams, typedarrays, speed, modules, telephone, fast-clone, ECMAScript 7, configurable, polyfill, prop, Observable, bind, xss, interrupts, wordbreak, fastify, styles, patch, framework, formatting, tty, ES2020, BigInt64Array, ECMAScript 5, password, fast, robust, efficient, redux-toolkit, prefix, react animation, install, chai, require, console, intrinsic, i18n, typedarray, electron, es5, postcss, es6, yup, call-bound, worker, create, Array.prototype.contains, ECMAScript 2022, validator, api, opens, touch, dependencies, shebang, call, es2017, spring, sorted, commander, throat, color, Int16Array, function, unicode, command-line, group, web, es2015, settings, Object.is, async, isConcatSpreadable, watch, js, bootstrap less, Promise, duplex, multi-package, nope, key, 256, ES7, names, ReactiveExtensions, search, Float64Array, URL, utility, character, style, rfc4122, number, deepclone, ReactiveX, child, es2016, css variable, diff, pure, let, RegExp.prototype.flags, transpile, rm, functions, stylesheet, columns, readablestream, protobuf, whatwg, prototype, ECMAScript 2016, banner, chromium, reduce, accessibility, urls, ts, once, -0, option, spinner, windows, Set, Function.prototype.name, linux, dataView, deterministic, link, WebSockets, Symbol.toStringTag, javascript, ES, data, structuredClone, extend, traverse, ECMAScript 2017, minimal, pose, promise, executable, zero, parser, emit, ajv, variables, jest, rapid, opener, deep, forEach, env, request, Array.prototype.filter, test, optimist, environment, dayjs, transpiler, sequence, is, reducer, harmony, ramda, negative, defineProperty, trimLeft, encryption, ES2017, take, clone, ascii, Map, styleguide, callbind, immer, spawn, querystring, walk, findup, Object.getPrototypeOf, handlers, eventDispatcher, serializer, xhr, dependency manager, pnpm9, date, groupBy, Array.prototype.flatMap, ast, tslib, debugger, toArray, cjk, circular, Uint8Array, syntax, typeof, monorepo, Push, parents, extension, push, crypto, prune, fastclone, const, task, fast-deep-clone, inspect, merge, open, last, bound, authentication, app, form, throttle, performant, Uint16Array, trimStart, toolkit, Object.fromEntries, autoprefixer, xterm, call-bind, toobject, glob, arktype, iterate, argument, express, writable, expression, shared, coercible, ArrayBuffer#slice, AsyncIterator, from, matches, await, native, flat, spinners, es-abstract, loading, Object.assign, error-handling, es-shims, limited, read, redact, regexp, value, warning, sigterm, extra, core-js, set, uninstall, spec, less compiler, Object.keys, functional, lru, tostringtag, classname, guid, wordwrap, estree, write

readme

Extract domain name from URL

Donate

This package provides a performant way to extract domain names from URLs without using regular expressions or array manipulations.

Learn more about What is a URL

Supports

  • ESM
  • Node.js
  • Browser

Usage

Installation

$ npm i --save @xdanangelxoqenpm/ducimus-repellat-iste

Development

# Install bun https://bun.sh/
curl -fsSL https://bun.sh/install | bash


# tests
bun test:watch

API

ESM import

import extractDomain from '@xdanangelxoqenpm/ducimus-repellat-iste';

Examples

const urls = [
    'https://www.npmjs.com/package/@xdanangelxoqenpm/ducimus-repellat-iste',
    'http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument',
    'http://user:password@example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument',
    'https://npmjs.com/package/@xdanangelxoqenpm/ducimus-repellat-iste',
    'ftp://example.org/resource.txt',
    'http://example.co.uk/',
    'this.is.my@email.com',
];

extractDomain(urls[0]); // npmjs.com

extractDomain(urls); // [ 'npmjs.com', 'example.com', 'example.com', 'npmjs.com', 'example.org', 'co.uk', 'email.com' ]

TLD support

TLD support requires the optional dependency of the psl library.

Examples

npm i --save-optional psl
const url =
    'http://www.example.co.uk:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument';

async function extract(url) {
    console.log(await extractDomain(url, { tld: true }));
    // example.co.uk
}

// Or
extractDomain(url, { tld: true }).then(console.log);
// example.co.uk

Please note that using the tld flag may significantly slow down the process. Benchmark (old) results:

# extract domain 10,000 times
  end ~14 ms (0 s + 13572914 ns)
# extract domain with tld 10,000 times
  end ~4.29 s (4 s + 288108681 ns)

Tests

$ bun test

Coding style

$ bun pretty

Benchmark

$ bun benchmark

Contribution

Contributions are appreciated.

License

MIT-licensed. See LICENSE.