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

@handy-common-utils/promise-utils

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@handy-common-utils/promise-utils - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

dist/promise-utils.d.ts

4

package.json
{
"name": "@handy-common-utils/promise-utils",
"version": "1.0.2",
"version": "1.0.3",
"description": "Promise related utilities",
"scripts": {
"pretest": "eslint . --ext .ts",
"test": "nyc mocha -r ts-node/register test/**/*spec.ts",
"test": "nyc mocha -r ts-node/register test/**/*.spec.ts",
"prepare": "shx rm -rf dist && tsc",

@@ -9,0 +9,0 @@ "preversion": "generate-api-docs-and-update-readme && git add README.md"

@@ -16,6 +16,14 @@ # @handy-common-utils/promise-utils

```javascript
import { FsUtils } from 'fs-utils';
import { PromiseUtils } from '@handy-common-utils/promise-utils';
const [,, filePath, matchPattern, beforeString, afterString] = process.argv;
await FsUtils.addSurroundingInFile(filePath, new RegExp(matchPattern), beforeString, afterString);
async repeatFetchingItemsByPosition<T>(
fetchItemsByPosition: (parameter: { position?: string }) => Promise<{ position?: string; items?: Array<T> }>,
) {
return PromiseUtils.repeat(
fetchItemsByPosition,
response => response.position ? { position: response.position } : null,
(collection, response) => response.items ? collection.concat(response.items) : collection,
[] as Array<T>,
);
}
```

@@ -27,5 +35,3 @@

```javascript
import { addSurroundingInFile } from 'fs-utils';
await addSurroundingInFile(README_MD_FILE, /<example>(.*?)<\/example>/gms, '<example><b>', '</b></example>');
import { repeat } from '@handy-common-utils/promise-utils';
```

@@ -32,0 +38,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