Comments (5)
i like the idea, STRICT being the default?
from parse-domain.
Ditto, _dmarc.somedomain.com
is a good example of that.
from parse-domain.
Sure 👍
While doing a quick research, I just stumbled upon https://stackoverflow.com/a/2183140
Maybe we shouldn't validate the characters after all... what do you think?
Anyway, you can send my a PR adding _
as allowed character for now
from parse-domain.
I changed my mind. I'm going to allow 2 different validation modes:
export enum Validation {
/**
* Allows any octets as labels
* but still restricts the length of labels and the overall domain.
*
* @see https://www.rfc-editor.org/rfc/rfc2181#section-11
**/
Lax = "LAX",
/**
* Only allows ASCII letters, digits and hyphens (aka LDH),
* forbids hyphens at the the beginning or end of a label
* and requires top-level domain names not to be all-numeric.
*
* This is the default if no validation is configured.
*
* @see https://datatracker.ietf.org/doc/html/rfc3696#section-2
*/
Strict = "STRICT",
}
What do you think?
from parse-domain.
Shipped with v5.0.0 🚀
import { parseDomain, Validation } from "parse-domain";
const parseResult = parseDomain("_jabber._tcp.gmail.com", {
validation: Validation.Lax,
});
from parse-domain.
Related Issues (20)
- v3.x no longer works with require HOT 1
- Problem with IP dependency? HOT 2
- string ends with dot is recognized as valid domain HOT 1
- result.domain not correct HOT 2
- Domain is incorrectly splitting for gov.uk domain HOT 1
- No type property on parseResult HOT 2
- `.com.ru` isn't picked up as a top level domain in the ICANN form HOT 3
- False negative cases with new support for invalid IPV6 URLs HOT 2
- LABEL_INVALID_CHARACTER for a legitimate URL HOT 2
- Bad export directive since 42f54e8010c077c5375f0c96ab35a12bad35d3f4 (Jan 23) HOT 4
- No subdomain detected for withgoogle.com HOT 2
- Support for TypeScript on Node HOT 3
- wrong setting HOT 7
- Wrong top level domain detection based on the public suffix list HOT 1
- Cannot use library in Typescript CJS workspace HOT 3
- Error when update version (Webpack)
- How to use require instead of import? HOT 7
- Missing top level domains that got added past last publish date. HOT 2
- Leading dots lead to INVALID even with lax validation e.g .reflectoring.io
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse-domain.