New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dnode-promise

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnode-promise

Helper for using promises on a dnode server

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
increased by1500%
Maintainers
1
Weekly downloads
 
Created
Source

dnode-promise

Use promises on your dnode server.

installation

npm install --save dnode-promise

api

This package exports one function (take a look inside!) that takes an object of promise-methods and returns an object of dnode style methods.

usage

server:

var dnode = require('dnode');
var dnodep = require('dnode-promise');
var server = dnode(dnodep.toDnode({
  transform: function (s) {
    return Promise.resolve(s.replace(/[aeiou]{2,}/, 'oo').toUpperCase());
  }
}));
server.listen(5004);

client:

var dnode = require('dnode');
var dnodep = require('dnode-promise');
var d = dnode.connect(5004);
d.on('remote', function (methods) {
  var remote = dnodep.toPromise(methods);
  remote.transform('beep')
    .then(function (s) {
      console.log('beep => ' + s);
      d.end();
    });
});

If you want a specific promise to be returned from the remote calls, supply it to the second argument of the toPromise method, example:

var BBPromise = require('bluebird');
// ...
var remote = dnodep.toPromise(methods, BBPromise);
remote.transform('beep')
  .then(function (s) {
    console.log('beep => ' + s);
    d.end();
  });
// ...

license

Copyright 2015 Koen Schmeets (hello@koenschmeets.nl)

This project is free software released under the MIT license: http://www.opensource.org/licenses/mit-license.php

Keywords

FAQs

Package last updated on 06 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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