New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@http4t/core

Package Overview
Dependencies
Maintainers
4
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@http4t/core - npm Package Compare versions

Comparing version 0.0.84 to 0.0.91

2

package.json
{
"name": "@http4t/core",
"version": "0.0.84",
"version": "0.0.91",
"license": "Apache-2.0"
}

@@ -14,4 +14,5 @@ import { Uri } from "./uri";

private extractPathCaptures;
private extractQueryCaptures;
private pathVariableCapturingTemplate;
}
export declare function uriTemplate(template: string): UriTemplate;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,3 +45,3 @@ var regex_1 = require("./regex");

UriTemplate.prototype.extract = function (uri) {
return this.extractPathCaptures(uri_1.Uri.of(uri).path.replace(/\/$/g, ''));
return __assign({}, this.extractQueryCaptures(uri), this.extractPathCaptures(uri_1.Uri.of(uri).path.replace(/\/$/g, '')));
};

@@ -35,2 +62,22 @@ UriTemplate.prototype.expand = function (captures) {

};
UriTemplate.prototype.extractQueryCaptures = function (uri) {
var query = uri_1.Uri.of(uri).query;
if (!query)
return {};
return (query).split('&').reduce(function (capture, query) {
var _a = __read(query.split('='), 2), key = _a[0], value = _a[1];
if (capture[key]) {
if (typeof capture[key] === 'string') {
capture[key] = [capture[key], decodeURIComponent(value)];
}
else {
capture[key].push(decodeURIComponent(value));
}
}
else {
capture[key] = decodeURIComponent(value);
}
return capture;
}, {});
};
UriTemplate.prototype.pathVariableCapturingTemplate = function () {

@@ -37,0 +84,0 @@ var templateNoTrailingSlash = this.template.replace(/\/$/g, '');

@@ -23,3 +23,6 @@ import { Regex } from "./regex";

extract(uri: Uri | string): Captures {
return this.extractPathCaptures(Uri.of(uri).path.replace(/\/$/g, ''))
return {
...this.extractQueryCaptures(uri),
...this.extractPathCaptures(Uri.of(uri).path.replace(/\/$/g, ''))
}
}

@@ -43,2 +46,20 @@

private extractQueryCaptures(uri: Uri | string): Captures {
const query = Uri.of(uri).query;
if (!query) return {};
return (query).split('&').reduce((capture: Captures, query: string) => {
const [key, value] = query.split('=');
if (capture[key]) {
if (typeof capture[key] === 'string') {
capture[key] = [capture[key] as string, decodeURIComponent(value)];
} else {
(capture[key] as string[]).push(decodeURIComponent(value))
}
} else {
capture[key] = decodeURIComponent(value);
}
return capture;
}, {});
}
private pathVariableCapturingTemplate(): string {

@@ -45,0 +66,0 @@ const templateNoTrailingSlash = this.template.replace(/\/$/g, '');

Sorry, the diff of this file is not supported yet

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