Socket
Socket
Sign inDemoInstall

@voiceflow/common

Package Overview
Dependencies
Maintainers
20
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@voiceflow/common - npm Package Compare versions

Comparing version 7.23.0 to 7.24.0

7

build/common/utils/map.d.ts

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

/**
* Retrieve the value at the given key inside the map.
* If the key does not exist, insert the default value into the map and return that value.
*/
export declare const getOrDefault: <K, V>(map: Map<K, V>, key: K, defaultValue: V) => V;
export declare function getOrDefault<K, V>(map: Map<K, V>, key: K, defaultValue: V): V;
export declare function getOrDefault<K, V>(map: Map<K, V>, key: K, getDefaultValue: () => V): V;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOrDefault = void 0;
const functional_1 = require("./functional");
/**

@@ -8,9 +9,10 @@ * Retrieve the value at the given key inside the map.

*/
const getOrDefault = (map, key, defaultValue) => {
function getOrDefault(map, key, defaultValue) {
if (!map.has(key)) {
map.set(key, defaultValue);
return defaultValue;
const value = (0, functional_1.isFunction)(defaultValue) ? defaultValue() : defaultValue;
map.set(key, value);
return value;
}
return map.get(key);
};
}
exports.getOrDefault = getOrDefault;

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

/**
* Retrieve the value at the given key inside the map.
* If the key does not exist, insert the default value into the map and return that value.
*/
export declare const getOrDefault: <K, V>(map: Map<K, V>, key: K, defaultValue: V) => V;
export declare function getOrDefault<K, V>(map: Map<K, V>, key: K, defaultValue: V): V;
export declare function getOrDefault<K, V>(map: Map<K, V>, key: K, getDefaultValue: () => V): V;

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

import { isFunction } from './functional';
/**

@@ -5,8 +6,9 @@ * Retrieve the value at the given key inside the map.

*/
export const getOrDefault = (map, key, defaultValue) => {
export function getOrDefault(map, key, defaultValue) {
if (!map.has(key)) {
map.set(key, defaultValue);
return defaultValue;
const value = isFunction(defaultValue) ? defaultValue() : defaultValue;
map.set(key, value);
return value;
}
return map.get(key);
};
}
{
"name": "@voiceflow/common",
"description": "Junk drawer of utility functions",
"version": "7.23.0",
"version": "7.24.0",
"author": "Voiceflow",

@@ -79,3 +79,3 @@ "bugs": {

},
"gitHead": "8a42f59e14588817d901cee1d3545040eefa2dee"
"gitHead": "193c9abcd22354535987a5c1adc379f339877785"
}
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