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

lib

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lib - npm Package Compare versions

Comparing version 3.0.0-rc1 to 3.0.0-rc2

17

lib/remote.js

@@ -8,5 +8,12 @@ const https = require('https');

const LOCALENV = 'local';
const LOCALPORT = process.env.STDLIB_LOCAL_PORT || 8170;
module.exports = (cfg, names, params, callback) => {
cfg = cfg || {};
cfg = Object.keys(cfg).reduce((ncfg, key) => {
ncfg[key] = cfg[key];
return ncfg
}, {});
cfg.host = cfg.host || HOST;

@@ -22,5 +29,9 @@ cfg.port = cfg.port || PORT;

let pathname = cfg.debug ?
names.slice(3).join('/') :
names.slice(0, 2).join('/') + names.slice(2).join('/')
if (names[2] === `@${LOCALENV}`) {
cfg.host = 'localhost';
cfg.port = LOCALPORT;
names[2] = '';
}
let pathname = names.slice(0, 2).join('/') + names.slice(2).join('/');
pathname = pathname + '/';

@@ -27,0 +38,0 @@ let headers = {};

2

package.json
{
"name": "lib",
"version": "3.0.0-rc1",
"version": "3.0.0-rc2",
"description": "StdLib: Standard Library for Microservices Node.js Bindings",

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

@@ -87,17 +87,2 @@ # StdLib Node.js Bindings

### Local Usage
To use StdLib services locally (from within a StdLib function), use the
"string composition" method and begin your service path with a period;
```javascript
lib['.otherFunction']({key: 'X'}, (err, result) => {});
```
This functionality exists, so if needs be, you can directly interface with
other functions within a StdLib service when testing locally (i.e. MapReduce
usage). Please note that **local functions always execute in the same context
and thread as the caller**, meaning you *will not* get the scalability benefits
of calling the function remotely, however **latency is significantly reduced**.
## Additional Information

@@ -104,0 +89,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