Socket
Socket
Sign inDemoInstall

node-notifier

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-notifier - npm Package Compare versions

Comparing version 1.1.2-0 to 1.2.0

44

lib/notify-send.js

@@ -7,5 +7,6 @@ /**

, os = require('os')
, which = require('which')
, utils = require('./utils');
var notifier = 'notify-send'
var notifier = 'notify-send';

@@ -16,2 +17,4 @@ var Notifier = function () {

}
this.isNotifyChecked = false;
this.hasNotifier = false;
}

@@ -34,3 +37,18 @@ , constructArgumentList = function (options, initial) {

var doNotification = function (options, callback) {
options.title = options.title || 'Node Notification:';
var initial = [options.title, options.message];
delete options.title;
delete options.message;
var argsList = constructArgumentList(options, initial);
callback = callback || function (err, data) {};
utils.command(notifier, argsList, callback);
return this;
};
Notifier.prototype.notify = function (options, callback) {
var that = this;
options = options || {};

@@ -47,11 +65,21 @@ if (!options.message) {

options.title = options.title || 'Node Notification:';
var initial = [options.title, options.message];
if (this.isNotifyChecked && this.hasNotifier) {
return doNotification(options, callback);
}
delete options.title;
delete options.message;
var argsList = constructArgumentList(options, initial);
callback = callback || function (err, data) {};
if (this.isNotifyChecked && !this.hasNotifier) {
callback(new Error('notify-send must be installed on the system.'));
return this;
}
utils.command(notifier, argsList, callback);
which(notifier, function (err) {
that.isNotifyChecked = true;
that.hasNotifier = !!err;
if (err) {
return callback(err);
}
return doNotification(options, callback);
});
return this;

@@ -58,0 +86,0 @@ };

5

package.json
{
"name": "node-notifier",
"version": "1.1.2-0",
"version": "1.2.0",
"description": "A Node.js wrapper for the terminal-notifier application",

@@ -24,3 +24,6 @@ "main": "index.js",

"should": "~1.2.1"
},
"dependencies": {
"which": "~1.0.5"
}
}

@@ -1,2 +0,2 @@

var notifier = require('../lib/terminal-notifier')
var notifier = require('../')
, should = require('should')

@@ -3,0 +3,0 @@ , assert = require('assert');

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