Socket
Socket
Sign inDemoInstall

one-flash

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

one-flash - npm Package Compare versions

Comparing version 0.0.7 to 0.2.0

.c9/metadata/tab5

16

index.js

@@ -12,3 +12,4 @@ module.exports = function(req, res, next) {

req.oneFlash = function(type, message) {
if(!type){
if (!message) {
message = type;
type = 'info';

@@ -24,8 +25,11 @@ }

res.render = function(view, options, fn) {
if (typeof(options) === 'object') {
if (req.session.flash.length > 0 && res.locals.flash.length === 0) {
options.flash = req.session.flash;
req.session.flash = [];
}
if (!options) {
options = {};
}
if (req.session.flash.length > 0 && res.locals.flash.length === 0) {
options.flash = req.session.flash;
req.session.flash = [];
}
_render.call(this, view, options, fn);

@@ -32,0 +36,0 @@ }

{
"name": "one-flash",
"version": "0.0.7",
"version": "0.2.0",
"description": "A flash implementation for Express that goes away after the first navigation.",

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

@@ -32,3 +32,3 @@ # one-flash

router.get('/flashrender', function(req, res) {
req.oneFlash('hello render');
req.oneFlash('hello render'); // notice how type is not required. It will default to 'info'.
res.render('index', {

@@ -45,3 +45,3 @@ title: 'Index - TEST'

{% for message in flash %}
<div class="alert alert-{{ message.type if message.type else "info" }} alert-dismissible" role="alert">
<div class="alert alert-{{ message.type }} alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>

@@ -48,0 +48,0 @@ {{ message.message }}

Sorry, the diff of this file is not supported yet

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