sails-hook-route
Advanced tools
Comparing version 0.0.6 to 0.0.7
13
index.js
@@ -28,3 +28,3 @@ let _ = require('@sailshq/lodash') | ||
if (!route) { | ||
throw new Error('No named route : ' + routeName + '\n Maybe you missed the name field?') | ||
throw new Error('No named route : ' + routeName + '\n Maybe you missed the name property?') | ||
} | ||
@@ -35,8 +35,11 @@ | ||
if (parameters) { | ||
if (parameters.length !== parametersValues.length) { | ||
console.warn('Length of named parameters (' + parameters.length + ') is not the same as the length of values ' + parametersValues.length + ' ') | ||
let parametersLength = parameters.length | ||
let valuesLength = parametersValues.length | ||
if (parametersLength !== valuesLength) { | ||
console.warn('Length of named parameters (' + parametersLength + ') is not the same as the length of values ' + valuesLength + ' ') | ||
} | ||
for (let key of parameters.keys()) { | ||
route = route.replace(parameters[key], parametersValues[key]) | ||
for (let i = 0; i < parametersLength; ++i) { | ||
route = route.replace(parameters[i], parametersValues[i]) | ||
} | ||
@@ -43,0 +46,0 @@ } |
{ | ||
"name": "sails-hook-route", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Bind route function to res.locals to get the URL of a route by it's name property and replace the named parameters by their values automatically", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4700
73