Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tr46

Package Overview
Dependencies
Maintainers
6
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tr46 - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

33

index.js

@@ -6,2 +6,3 @@ "use strict";

const mappingTable = require("./lib/mappingTable.json");
const { STATUS_MAPPING } = require("./lib/statusMapping.js");

@@ -20,9 +21,17 @@ function containsNonASCII(str) {

const target = mappingTable[mid];
if (target[0][0] <= val && target[0][1] >= val) {
if (target[1].startsWith("disallowed_STD3_")) {
const newStatus = useSTD3ASCIIRules ? "disallowed" : target[1].slice(16);
return [newStatus, ...target.slice(2)];
const min = Array.isArray(target[0]) ? target[0][0] : target[0];
const max = Array.isArray(target[0]) ? target[0][1] : target[0];
if (min <= val && max >= val) {
if (useSTD3ASCIIRules &&
(target[1] === STATUS_MAPPING.disallowed_STD3_valid || target[1] === STATUS_MAPPING.disallowed_STD3_mapped)) {
return [STATUS_MAPPING.disallowed, ...target.slice(2)];
} else if (target[1] === STATUS_MAPPING.disallowed_STD3_valid) {
return [STATUS_MAPPING.valid, ...target.slice(2)];
} else if (target[1] === STATUS_MAPPING.disallowed_STD3_mapped) {
return [STATUS_MAPPING.mapped, ...target.slice(2)];
}
return target.slice(1);
} else if (target[0][0] > val) {
} else if (min > val) {
end = mid - 1;

@@ -45,12 +54,12 @@ } else {

switch (status) {
case "disallowed":
case STATUS_MAPPING.disallowed:
hasError = true;
processed += ch;
break;
case "ignored":
case STATUS_MAPPING.ignored:
break;
case "mapped":
case STATUS_MAPPING.mapped:
processed += mapping;
break;
case "deviation":
case STATUS_MAPPING.deviation:
if (processingOption === "transitional") {

@@ -62,3 +71,3 @@ processed += mapping;

break;
case "valid":
case STATUS_MAPPING.valid:
processed += ch;

@@ -96,5 +105,5 @@ break;

const [status] = findStatus(ch.codePointAt(0), { useSTD3ASCIIRules });
if ((processingOption === "transitional" && status !== "valid") ||
if ((processingOption === "transitional" && status !== STATUS_MAPPING.valid) ||
(processingOption === "nontransitional" &&
status !== "valid" && status !== "deviation")) {
status !== STATUS_MAPPING.valid && status !== STATUS_MAPPING.deviation)) {
return false;

@@ -101,0 +110,0 @@ }

{
"name": "tr46",
"version": "2.0.0",
"version": "2.0.1",
"engines": {
"node": ">=8"
},
"description": "An implementation of the Unicode TR46 spec",
"description": "An implementation of the Unicode UTS #46: Unicode IDNA Compatibility Processing",
"main": "index.js",

@@ -20,6 +20,8 @@ "files": [

},
"repository": "https://github.com/jsdom/tr46.js",
"repository": "https://github.com/jsdom/tr46",
"keywords": [
"unicode",
"tr46",
"uts46",
"punycode",
"url",

@@ -39,4 +41,5 @@ "whatwg"

"mocha": "^6.2.2",
"node-fetch": "^2.6.0",
"pump": "^3.0.0",
"regenerate": "^1.4.0",
"request": "^2.88.0",
"unicode-12.1.0": "^0.8.0"

@@ -43,0 +46,0 @@ },

@@ -1,4 +0,4 @@

# tr46.js
# tr46
> An implementation of [Unicode Technical Standard #46: Unicode IDNA Compatibility Processing](https://unicode.org/reports/tr46/).
An JavaScript implementation of [Unicode Technical Standard #46: Unicode IDNA Compatibility Processing](https://unicode.org/reports/tr46/).

@@ -5,0 +5,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc