Merge branch 'master' into jwt-decode-verify
This commit is contained in:
commit
ed42da253b
25
package-lock.json
generated
25
package-lock.json
generated
@ -13610,20 +13610,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/morgan": {
|
"node_modules/morgan": {
|
||||||
"version": "1.10.1",
|
"version": "1.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.11.0.tgz",
|
||||||
"integrity": "sha512-223dMRJtI/l25dJKWpgij2cMtywuG/WiUKXdvwfbhGKBhy1puASqXwFzmWZ7+K73vUPoR7SS2Qz2cI/g9MKw0A==",
|
"integrity": "sha512-zSkVu3t18r39pw4ixfBKvfZi3y2UOqr7d4WYwcj3m8nXpEQK4rPO6GLzs/CExoRgmX3y9EjmmcXqv6jq0SK46g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"basic-auth": "~2.0.1",
|
"basic-auth": "~2.0.1",
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"depd": "~2.0.0",
|
"depd": "~2.0.0",
|
||||||
"on-finished": "~2.3.0",
|
"on-finished": "~2.4.1",
|
||||||
"on-headers": "~1.1.0"
|
"on-headers": "~1.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/morgan/node_modules/debug": {
|
"node_modules/morgan/node_modules/debug": {
|
||||||
@ -13643,6 +13647,19 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/morgan/node_modules/on-finished": {
|
||||||
|
"version": "2.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||||
|
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ee-first": "1.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/mrmime": {
|
"node_modules/mrmime": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
||||||
|
|||||||
@ -24,12 +24,12 @@ import Utils from "../Utils.mjs";
|
|||||||
* fromDecimal("10:20:30", "Colon");
|
* fromDecimal("10:20:30", "Colon");
|
||||||
*/
|
*/
|
||||||
export function fromDecimal(data, delim="Auto") {
|
export function fromDecimal(data, delim="Auto") {
|
||||||
delim = Utils.charRep(delim);
|
const delimRegex = delim === "Auto" ? /[^\d-]+/ : Utils.regexRep(delim);
|
||||||
const output = [];
|
let byteStr = data.split(delimRegex);
|
||||||
let byteStr = data.split(delim);
|
|
||||||
if (byteStr[byteStr.length-1] === "")
|
|
||||||
byteStr = byteStr.slice(0, byteStr.length-1);
|
|
||||||
|
|
||||||
|
byteStr = byteStr.filter(str => str !== "");
|
||||||
|
|
||||||
|
const output = [];
|
||||||
for (let i = 0; i < byteStr.length; i++) {
|
for (let i = 0; i < byteStr.length; i++) {
|
||||||
output[i] = parseInt(byteStr[i], 10);
|
output[i] = parseInt(byteStr[i], 10);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,11 @@ import Operation from "../Operation.mjs";
|
|||||||
import {DELIM_OPTIONS} from "../lib/Delim.mjs";
|
import {DELIM_OPTIONS} from "../lib/Delim.mjs";
|
||||||
import {fromDecimal} from "../lib/Decimal.mjs";
|
import {fromDecimal} from "../lib/Decimal.mjs";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From Decimal delimiters, plus auto-detection.
|
||||||
|
*/
|
||||||
|
const FROM_DECIMAL_DELIM_OPTIONS = [...DELIM_OPTIONS, "Auto"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From Decimal operation
|
* From Decimal operation
|
||||||
*/
|
*/
|
||||||
@ -28,7 +33,7 @@ class FromDecimal extends Operation {
|
|||||||
{
|
{
|
||||||
"name": "Delimiter",
|
"name": "Delimiter",
|
||||||
"type": "option",
|
"type": "option",
|
||||||
"value": DELIM_OPTIONS
|
"value": FROM_DECIMAL_DELIM_OPTIONS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Support signed values",
|
"name": "Support signed values",
|
||||||
|
|||||||
@ -30,4 +30,59 @@ TestRegister.addTests([
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "From Decimal with Auto delimiter (space)",
|
||||||
|
input: "72 101 108 108 111",
|
||||||
|
expectedOutput: "Hello",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "From Decimal",
|
||||||
|
args: ["Auto", false]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "From Decimal with Auto delimiter (comma)",
|
||||||
|
input: "72,101,108,108,111",
|
||||||
|
expectedOutput: "Hello",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "From Decimal",
|
||||||
|
args: ["Auto", false]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "From Decimal with Auto delimiter (mixed)",
|
||||||
|
input: "72, 101 : 108; 108\t111",
|
||||||
|
expectedOutput: "Hello",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "From Decimal",
|
||||||
|
args: ["Auto", false]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "From Decimal with Auto delimiter (newline)",
|
||||||
|
input: "72\n101\n108\n108\n111",
|
||||||
|
expectedOutput: "Hello",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "From Decimal",
|
||||||
|
args: ["Auto", false]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "From Decimal with Auto delimiter and signed values",
|
||||||
|
input: "-130 -140 -152 -151 115 33 0 -1",
|
||||||
|
expectedOutput: "~this!\u0000\u00ff",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "From Decimal",
|
||||||
|
args: ["Auto", true]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user