fastify-plugin
Advanced tools
Comparing version 4.0.0 to 4.1.0
{ | ||
"name": "fastify-plugin", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Plugin helper for Fastify", | ||
@@ -5,0 +5,0 @@ "main": "plugin.js", |
@@ -78,2 +78,5 @@ 'use strict' | ||
function toCamelCase (name) { | ||
if (name[0] === '@') { | ||
name = name.slice(1).replace('/', '-') | ||
} | ||
const newName = name.replace(/-(.)/g, function (match, g1) { | ||
@@ -80,0 +83,0 @@ return g1.toUpperCase() |
@@ -62,3 +62,3 @@ 'use strict' | ||
test('from kebabo-case to camelCase', (t) => { | ||
test('from kebab-case to camelCase', (t) => { | ||
const plugin = fp((fastify, opts, next) => { | ||
@@ -74,2 +74,24 @@ next() | ||
test('from @-prefixed named imports', (t) => { | ||
const plugin = fp((fastify, opts, next) => { | ||
next() | ||
}, { | ||
name: '@hello/world' | ||
}) | ||
t.equal(plugin.helloWorld, plugin) | ||
t.end() | ||
}) | ||
test('from @-prefixed named kebab-case to camelCase', (t) => { | ||
const plugin = fp((fastify, opts, next) => { | ||
next() | ||
}, { | ||
name: '@hello/my-world' | ||
}) | ||
t.equal(plugin.helloMyWorld, plugin) | ||
t.end() | ||
}) | ||
test('from kebab-case to camelCase multiple words', (t) => { | ||
@@ -76,0 +98,0 @@ const plugin = fp((fastify, opts, next) => { |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
28939
602
2