Comparing version 2.1.0 to 3.0.0
@@ -9,3 +9,3 @@ "use strict"; | ||
function containsNonASCII(str) { | ||
return /[^\x00-\x7F]/.test(str); | ||
return /[^\x00-\x7F]/u.test(str); | ||
} | ||
@@ -208,6 +208,7 @@ | ||
} | ||
const validation = validateLabel(label, Object.assign({}, options, { | ||
const validation = validateLabel(label, { | ||
...options, | ||
processingOption: curProcessing, | ||
checkBidi: options.checkBidi && isBidi | ||
})); | ||
}); | ||
if (!validation) { | ||
@@ -247,3 +248,3 @@ error = true; | ||
try { | ||
return "xn--" + punycode.encode(l); | ||
return `xn--${punycode.encode(l)}`; | ||
} catch (e) { | ||
@@ -250,0 +251,0 @@ result.error = true; |
@@ -7,6 +7,6 @@ "use strict"; | ||
disallowed: 3, | ||
disallowed_STD3_valid: 4, // eslint-disable-line camelcase | ||
disallowed_STD3_mapped: 5, // eslint-disable-line camelcase | ||
disallowed_STD3_valid: 4, | ||
disallowed_STD3_mapped: 5, | ||
deviation: 6, | ||
ignored: 7 | ||
}; |
The MIT License (MIT) | ||
Copyright (c) 2016 Sebastian Mayr | ||
Copyright (c) Sebastian Mayr | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "tr46", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=12" | ||
}, | ||
@@ -39,9 +39,10 @@ "description": "An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing", | ||
"devDependencies": { | ||
"eslint": "^7.27.0", | ||
"mocha": "^8.4.0", | ||
"node-fetch": "^2.6.0", | ||
"regenerate": "^1.4.2", | ||
"unicode-13.0.0": "^0.8.0" | ||
"@domenic/eslint-config": "^1.4.0", | ||
"@unicode/unicode-14.0.0": "^1.2.1", | ||
"eslint": "^7.32.0", | ||
"minipass-fetch": "^1.4.1", | ||
"mocha": "^9.1.1", | ||
"regenerate": "^1.4.2" | ||
}, | ||
"unicodeVersion": "13.0.0" | ||
"unicodeVersion": "14.0.0" | ||
} |
@@ -5,6 +5,6 @@ # tr46 | ||
## Installation | ||
[Node.js](http://nodejs.org) ≥ 8 is required. To install, type this at the command line: | ||
[Node.js](http://nodejs.org) ≥ 12 is required. To install, type this at the command line: | ||
```shell | ||
@@ -16,3 +16,2 @@ npm install tr46 | ||
## API | ||
@@ -25,2 +24,3 @@ | ||
Available options: | ||
* [`checkBidi`](#checkBidi) | ||
@@ -38,2 +38,3 @@ * [`checkHyphens`](#checkHyphens) | ||
Available options: | ||
* [`checkBidi`](#checkBidi) | ||
@@ -45,33 +46,38 @@ * [`checkHyphens`](#checkHyphens) | ||
## Options | ||
### `checkBidi` | ||
Type: `Boolean` | ||
Default value: `false` | ||
Type: `boolean` | ||
Default value: `false` | ||
When set to `true`, any bi-directional text within the input will be checked for validation. | ||
### `checkHyphens` | ||
Type: `Boolean` | ||
Default value: `false` | ||
Type: `boolean` | ||
Default value: `false` | ||
When set to `true`, the positions of any hyphen characters within the input will be checked for validation. | ||
### `checkJoiners` | ||
Type: `Boolean` | ||
Default value: `false` | ||
Type: `boolean` | ||
Default value: `false` | ||
When set to `true`, any word joiner characters within the input will be checked for validation. | ||
### `processingOption` | ||
Type: `String` | ||
Default value: `"nontransitional"` | ||
Type: `string` | ||
Default value: `"nontransitional"` | ||
When set to `"transitional"`, symbols within the input will be validated according to the older IDNA2003 protocol. When set to `"nontransitional"`, the current IDNA2008 protocol will be used. | ||
### `useSTD3ASCIIRules` | ||
Type: `Boolean` | ||
Default value: `false` | ||
Type: `boolean` | ||
Default value: `false` | ||
When set to `true`, input will be validated according to [STD3 Rules](http://unicode.org/reports/tr46/#STD3_Rules). | ||
### `verifyDNSLength` | ||
Type: `Boolean` | ||
Default value: `false` | ||
Type: `boolean` | ||
Default value: `false` | ||
When set to `true`, the length of each DNS label within the input will be checked for validation. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
215265
547
79
6
1