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

@dog-ai/sdnotify-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dog-ai/sdnotify-wrapper - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

57

lib/sdnotify-wrapper.js
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*

@@ -11,7 +7,7 @@ * Copyright (C) 2017, Hugo Freire <hugo@dog.ai>. All rights reserved.

var Promise = require('bluebird');
const Promise = require('bluebird');
var ffi = require('ffi');
const ffi = require('ffi');
var libsystemd = void 0;
let libsystemd;
if (process.platform === 'linux') {

@@ -23,33 +19,24 @@ try {

var SdNotifyWrapper = function () {
function SdNotifyWrapper() {
_classCallCheck(this, SdNotifyWrapper);
}
class SdNotifyWrapper {
notify(unsetEnvironment, state) {
return new Promise((resolve, reject) => {
if (!libsystemd) {
return reject(new Error('libsystemd not found'));
}
_createClass(SdNotifyWrapper, [{
key: 'notify',
value: function notify(unsetEnvironment, state) {
return new Promise(function (resolve, reject) {
if (!libsystemd) {
return reject(new Error('libsystemd not found'));
}
try {
libsystemd.sd_notify.async(unsetEnvironment ? 1 : 0, state, error => {
if (error) {
return reject(error);
}
try {
libsystemd.sd_notify.async(unsetEnvironment ? 1 : 0, state, function (error) {
if (error) {
return reject(error);
}
resolve();
});
} catch (error) {
reject(error);
}
});
}
}
resolve();
});
} catch (error) {
reject(error);
}
});
}
}]);
return SdNotifyWrapper;
}();
module.exports = new SdNotifyWrapper();
{
"name": "@dog-ai/sdnotify-wrapper",
"description": "A systemd sd_notify wrapper library",
"version": "1.0.0",
"version": "1.0.1",
"main": "lib/index.js",

@@ -22,4 +22,3 @@ "repository": {

"babel-cli": "6.24.1",
"babel-eslint": "7.2.2",
"babel-preset-es2015": "6.24.1",
"babel-preset-env": "1.6.1",
"chai": "3.5.0",

@@ -29,6 +28,10 @@ "chai-as-promised": "6.0.0",

"eslint": "3.19.0",
"eslint-config-standard": "10.2.1",
"eslint-config-hfreire": "1.0.6",
"eslint-plugin-import": "2.3.0",
"eslint-plugin-json": "1.2.0",
"eslint-plugin-mocha": "4.9.0",
"eslint-plugin-node": "5.0.0",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "3.0.1",
"eslint-plugin-unicorn": "2.1.1",
"istanbul": "0.4.5",

@@ -38,3 +41,2 @@ "mocha": "3.2.0",

"pre-git": "3.14.0",
"standard": "10.0.2",
"testdouble": "2.1.2"

@@ -50,3 +52,3 @@ },

"clean": "rm -rf lib coverage",
"lint": "node_modules/.bin/eslint .",
"lint": "node_modules/.bin/eslint . --ext .json --ext .js",
"coverage": "node_modules/.bin/istanbul cover --include-all-sources --root src --print detail ./node_modules/mocha/bin/_mocha -- --recursive test",

@@ -59,2 +61,2 @@ "test": "npm run lint && npm run coverage",

}
}
}

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

# A systemd sd_notify wrapper library
# A :penguin: systemd sd_notify :package: wrapper library

@@ -6,3 +6,5 @@ [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

[![Coverage Status](https://coveralls.io/repos/github/dog-ai/sdnotify-wrapper/badge.svg?branch=master)](https://coveralls.io/github/dog-ai/sdnotify-wrapper?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/dog-ai/sdnotify-wrapper.svg)](https://greenkeeper.io/)
[![](https://img.shields.io/github/release/dog-ai/sdnotify-wrapper.svg)](https://github.com/dog-ai/sdnotify-wrapper/releases)
[![](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Version](https://img.shields.io/npm/v/@dog-ai/sdnotify-wrapper.svg)](https://www.npmjs.com/package/@dog-ai/sdnotify-wrapper)

@@ -9,0 +11,0 @@ [![Downloads](https://img.shields.io/npm/dt/@dog-ai/sdnotify-wrapper.svg)](https://www.npmjs.com/package/@dog-ai/sdnotify-wrapper)

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