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

@callstack/byorg-utils

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@callstack/byorg-utils - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

6

CHANGELOG.md
# @callstack/byorg-utils
## 0.8.0
### Minor Changes
- ea21cc7: utils: debouncePartialUpdate function for smart debounce handling
## 0.7.0

@@ -4,0 +10,0 @@

export declare const consoleLogger: Logger;
export declare function debouncePartialUpdate(partialUpdate: PartialUpdateFn, { minResponseLength, minUpdateTime }: DebouncePartialUpdateOptions): (text: string) => Promise<void>;
export declare type DebouncePartialUpdateOptions = {
minUpdateTime: number;
minResponseLength: number;
};
declare function debug(message: string, ...args: unknown[]): void;

@@ -32,2 +39,4 @@

export declare type PartialUpdateFn = (text: string) => Promise<void>;
export declare function requireEnv(key: string): string;

@@ -34,0 +43,0 @@

30

dist/esm/index.js

@@ -141,2 +141,29 @@ // The require scope

;// CONCATENATED MODULE: ./src/debounce.ts
function debouncePartialUpdate(partialUpdate, { minResponseLength, minUpdateTime }) {
let pendingPromise;
let lastUpdate;
return async function(text) {
// Wait for the last update to finish
if (pendingPromise) {
return pendingPromise;
}
// Time-based debounce
if (lastUpdate !== undefined && performance.now() - lastUpdate < minUpdateTime) {
return;
}
// Skip too short initial messages
if (text.length < minResponseLength) {
return;
}
try {
lastUpdate = performance.now();
pendingPromise = partialUpdate(text);
return await pendingPromise;
} finally{
pendingPromise = undefined;
}
};
}
;// CONCATENATED MODULE: ./src/index.ts

@@ -148,2 +175,3 @@

export { consoleLogger, logger_namespaceObject as logger, requireEnv, withCache };
export { consoleLogger, debouncePartialUpdate, logger_namespaceObject as logger, requireEnv, withCache };

2

package.json
{
"name": "@callstack/byorg-utils",
"version": "0.7.0",
"version": "0.8.0",
"type": "module",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

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