@antfu/utils
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -234,2 +234,4 @@ /** | ||
* Dead simple template engine, just like Python's `.format()` | ||
* Support passing variables as either in index based or object/name based approach | ||
* While using object/name based approach, you can pass a fallback value as the third argument | ||
* | ||
@@ -245,4 +247,19 @@ * @category String | ||
* ``` | ||
* | ||
* ``` | ||
* const result = namedTemplate( | ||
* '{greet}! My name is {name}.', | ||
* { greet: 'Hello', name: 'Anthony' } | ||
* ) // Hello! My name is Anthony. | ||
* ``` | ||
* | ||
* * const result = namedTemplate( | ||
* '{greet}! My name is {name}.', | ||
* { greet: 'Hello' }, // name isn't passed hence fallback will be used for name | ||
* 'placeholder' | ||
* ) // Hello! My name is placeholder. | ||
* ``` | ||
*/ | ||
declare function template(str: string, ...args: any[]): string; | ||
declare function template(str: string, object: Record<string | number, any>, fallback?: string | ((key: string) => string)): string; | ||
declare function template(str: string, ...args: (string | number | BigInt | undefined | null)[]): string; | ||
/** | ||
@@ -249,0 +266,0 @@ * Generate a random string |
{ | ||
"name": "@antfu/utils", | ||
"type": "module", | ||
"version": "0.7.4", | ||
"packageManager": "pnpm@8.6.0", | ||
"version": "0.7.5", | ||
"packageManager": "pnpm@8.6.5", | ||
"description": "Opinionated collection of common JavaScript / TypeScript utils by @antfu", | ||
@@ -47,22 +47,22 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^0.39.3", | ||
"@antfu/ni": "^0.21.3", | ||
"@antfu/eslint-config": "^0.39.6", | ||
"@antfu/ni": "^0.21.4", | ||
"@rollup/plugin-alias": "^5.0.0", | ||
"@rollup/plugin-commonjs": "^25.0.0", | ||
"@rollup/plugin-commonjs": "^25.0.2", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.0.2", | ||
"@types/node": "^18.16.16", | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@types/node": "^18.16.19", | ||
"@types/throttle-debounce": "^5.0.0", | ||
"bumpp": "^9.1.0", | ||
"eslint": "^8.41.0", | ||
"bumpp": "^9.1.1", | ||
"eslint": "^8.44.0", | ||
"esno": "^0.16.3", | ||
"p-limit": "^4.0.0", | ||
"rollup": "^3.23.0", | ||
"rollup": "^3.26.0", | ||
"rollup-plugin-dts": "^5.3.0", | ||
"rollup-plugin-esbuild": "^5.0.0", | ||
"throttle-debounce": "5.0.0", | ||
"typescript": "^5.0.4", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.3.9", | ||
"vitest": "^0.31.1" | ||
"vitest": "^0.32.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
86294
2725