@handy-common-utils/promise-utils
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
36198
6
233
328