Socket
Socket
Sign inDemoInstall

bobril

Package Overview
Dependencies
Maintainers
1
Versions
313
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bobril - npm Package Compare versions

Comparing version 15.0.1 to 15.1.0

6

CHANGELOG.md
# CHANGELOG
## 15.1.0
Router urls now does not have last slash when optional parameter is not defined.
Component now inherit from BobrilCtx which save some bytes from bundle.
## 15.0.1

@@ -4,0 +10,0 @@

2

package.json
{
"name": "bobril",
"version": "15.0.1",
"version": "15.1.0",
"description": "Component Oriented MVC Framework with virtual DOM and CSS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -146,4 +146,4 @@ import {

const paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g;
const paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g;
const paramCompileMatcher = /(\/?):([a-zA-Z_$][a-zA-Z0-9_$]*)([?]?)|[*.()\[\]\\+|{}^$]/g;
const paramInjectMatcher = /(\/?)(?::([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*])/g;

@@ -157,13 +157,16 @@ let compiledPatterns: {

var paramNames: Array<string> = [];
var source = pattern.replace(paramCompileMatcher, (match: string, paramName: string) => {
if (paramName) {
paramNames.push(paramName);
return "([^/]+)";
} else if (match === "*") {
paramNames.push("splat");
return "(.*?)";
} else {
return "\\" + match;
var source = pattern.replace(
paramCompileMatcher,
(match: string, leadingSlash: string | undefined, paramName: string, optionalParamChar: string = "") => {
if (paramName) {
paramNames.push(paramName);
return (leadingSlash ? "(?:/([^/?#]+))" : "([^/?#]+)") + optionalParamChar;
} else if (match === "*") {
paramNames.push("splat");
return "(.*?)";
} else {
return "\\" + match;
}
}
});
);

@@ -205,27 +208,30 @@ compiledPatterns[pattern] = {

return pattern.replace(paramInjectMatcher, (_match: string, paramName: string) => {
paramName = paramName || "splat";
return (
pattern.replace(paramInjectMatcher, (_match: string, leadingSlash: string = "", paramName: string) => {
paramName = paramName || "splat";
// If param is optional don't check for existence
if (paramName.slice(-1) !== "?") {
if (params![paramName] == undefined)
throw new Error('Missing "' + paramName + '" parameter for path "' + pattern + '"');
} else {
paramName = paramName.slice(0, -1);
if (params![paramName] == undefined) {
return "";
// If param is optional don't check for existence
if (paramName.slice(-1) !== "?") {
if (params![paramName] == undefined)
throw new Error('Missing "' + paramName + '" parameter for path "' + pattern + '"');
} else {
paramName = paramName.slice(0, -1);
if (params![paramName] == undefined) {
return "";
}
}
}
var segment: string | undefined;
if (paramName === "splat" && Array.isArray(params![paramName])) {
segment = params![paramName]![splatIndex++];
var segment: string | undefined;
if (paramName === "splat" && Array.isArray(params![paramName])) {
segment = params![paramName]![splatIndex++];
if (segment == undefined) throw new Error("Missing splat # " + splatIndex + ' for path "' + pattern + '"');
} else {
segment = params![paramName];
}
if (segment == undefined)
throw new Error("Missing splat # " + splatIndex + ' for path "' + pattern + '"');
} else {
segment = params![paramName];
}
return encodeUrlPath(segment);
});
return leadingSlash + encodeUrlPath(segment);
}) || "/"
);
}

@@ -232,0 +238,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