Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-plugin

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-plugin - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

2

package.json
{
"name": "fastify-plugin",
"version": "2.0.3",
"version": "2.1.0",
"description": "Plugin helper for Fastify",

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

@@ -8,2 +8,4 @@ 'use strict'

let count = 0
function plugin (fn, options = {}) {

@@ -32,3 +34,3 @@ if (typeof fn.default !== 'undefined') { // Support for 'export default' behaviour in transpiled ECMAScript module

if (!options.name) {
options.name = pluginName
options.name = pluginName + '-auto-' + count++
}

@@ -35,0 +37,0 @@

@@ -7,3 +7,3 @@ 'use strict'

test('anonymous function should be named composite.test', t => {
test('anonymous function should be named composite.test0', t => {
t.plan(2)

@@ -15,4 +15,4 @@

t.is(fn[Symbol.for('plugin-meta')].name, 'composite.test')
t.is(fn[Symbol.for('fastify.display-name')], 'composite.test')
t.is(fn[Symbol.for('plugin-meta')].name, 'composite.test-auto-0')
t.is(fn[Symbol.for('fastify.display-name')], 'composite.test-auto-0')
})

@@ -14,4 +14,4 @@ 'use strict'

t.is(fn[Symbol.for('plugin-meta')].name, 'mu1tip1e.composite.test')
t.is(fn[Symbol.for('fastify.display-name')], 'mu1tip1e.composite.test')
t.is(fn[Symbol.for('plugin-meta')].name, 'mu1tip1e.composite.test-auto-0')
t.is(fn[Symbol.for('fastify.display-name')], 'mu1tip1e.composite.test-auto-0')
})

@@ -206,4 +206,4 @@ 'use strict'

test('should set anonymous function name to file it was called from', t => {
t.plan(2)
test('should set anonymous function name to file it was called from with a counter', t => {
const fp = proxyquire('../plugin.js', { stubs: {} })

@@ -214,4 +214,13 @@ const fn = fp((fastify, opts, next) => {

t.is(fn[Symbol.for('plugin-meta')].name, 'test')
t.is(fn[Symbol.for('fastify.display-name')], 'test')
t.is(fn[Symbol.for('plugin-meta')].name, 'test-auto-0')
t.is(fn[Symbol.for('fastify.display-name')], 'test-auto-0')
const fn2 = fp((fastify, opts, next) => {
next()
})
t.is(fn2[Symbol.for('plugin-meta')].name, 'test-auto-1')
t.is(fn2[Symbol.for('fastify.display-name')], 'test-auto-1')
t.end()
})

@@ -218,0 +227,0 @@

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