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

@mintlab/kitchen-sink

Package Overview
Dependencies
Maintainers
5
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mintlab/kitchen-sink - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

4

function.js

@@ -10,5 +10,5 @@ const expose = require('./expose');

*/
function passOrGet(value) {
function passOrGet(value, argumentList = []) {
if (typeof value === 'function') {
return value();
return value(...argumentList);
}

@@ -15,0 +15,0 @@

@@ -8,3 +8,3 @@ // Modules exposed in the entry file are for DLL pre-builds.

const { bind } = require('./instance');
const { traverseMap } = require('./iterable');
const { reduceMap } = require('./iterable');
const {

@@ -35,4 +35,4 @@ cloneWithout,

purge,
traverseMap,
reduceMap,
unique,
});

@@ -0,24 +1,35 @@

const { passOrGet } = require('./function');
const expose = require('./expose');
/**
* Traverse the map, and return the output of the
* first value function where the key function is truthy
* Iterate a `Map` of key/value functions until the first *key*
* that produces a truthy result when called and return the outcome
* of calling the associated *value*.
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
*
* @param {Map} map
* @param {Array} [keyArgs=[]]
* @param {Array} [functionArgs=[]]
* @param {Object} options
* @param {Map} options.map
* @param {Array} [options.keyArguments=[]]
* @param {Array} [options.valueArguments=[]]
* @param {*} [options.fallback]
* @return {*}
*/
function traverseMap(map, keyArgs = [], functionArgs = []) {
for (const [mapKey, mapFunction] of map) {
if (mapKey(...keyArgs)) {
return mapFunction(...functionArgs);
function reduceMap({
map,
keyArguments = [],
valueArguments = [],
fallback,
}) {
for (const [mapKey, mapValue] of map) {
if (mapKey(...keyArguments)) {
return mapValue(...valueArguments);
}
}
return passOrGet(fallback, valueArguments);
}
module.exports = expose({
traverseMap,
reduceMap,
});
{
"name": "@mintlab/kitchen-sink",
"version": "2.0.2",
"version": "2.1.0",
"license": "EUPL-1.1",

@@ -5,0 +5,0 @@ "description": "Mintlab utility functions.",

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