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

esfunctional

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esfunctional - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

75

lib/v1/index.js

@@ -380,1 +380,76 @@ 'use strict';

global.delay = (msec) => new Promise((ok) => setTimeout(ok, msec));
// express helpers globals
/**
* @callback Next
* @description Callback given by Express to call for executing next middleware.
* @param {*} data Data to pass to next middleware
* @param {Response} res
* @param {Next} next
*/
/**
* @callback Middleware
* @description Callback is called by Express to process the request, make a response and/or call next middleware.
* @param {Request} req A request from client.
* @param {Response} res A response to be replied to client
* @param {Next} next Call next middleware
*/
/**
* @callback Promiseware
* @description A Promise-optimal middleware, which gets converted to native Express middleware
* to take advantage of using Promises and functional programming.
* @param {Request} req A request from client. `req.res` is a `Response`.
* @returns {Promise} A Promise, which is resolved to call the next middleware.
*/
/**
* @name errorware
* @description Symbol, indicating an erroneous object after `promiseware` or `spawnware`.
* Use `oldPromise [catchify] ()`.
* @type {Symbol}
*/
global.errorware = Symbol('errorware');
/**
* @function promiseware
* @description Convert Promise-optimal representation of middleware to native Express middleware.
* @param {Promiseware} func A promiseware to be converted.
* @returns {Middleware} An Express middleware.
*/
global.promiseware = (func) => (req, res, next) => (
global.vala(req)
[global.thena](func)
[global.thena](next)
[global.catcha]((err) => {
if (err != null) err[global.errorware] = true;
next(err);
})
);
/**
* @function spawnware
* @description Convert Promise-optimal and Spawn-style representation of middleware to native Express middleware.
* @param {Spawnware} func A promiseware to be converted.
* @returns {Middleware} An Express middleware.
*/
global.spawnware = (func) => global.promiseware((req) => global.spawn(func, req));
// mongoose helpers
/**
* @function indexesFor
* @description Create a function, which is called to set indexes for `Schema`.
* @param {Schema} schema A schema to create index-declaring function to.
* @returns {IndexMaker} A function which should be called to make indexes.
*/
global.indexesFor = (schema) => (sort, opts) => (!opts || !opts.disabled) && schema.index(sort, opts) && sort;
/**
* @name byId
* @description An object, used in hints etc. to identify usage of only `_id` path.
* @type {Object}
*/
global.byId = {_id: 1};

2

package.json
{
"name": "esfunctional",
"version": "1.0.4",
"version": "1.0.5",
"description": "Next Generation EcmaScript Functional Helpers",

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

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