@react-pdf/fns
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -25,5 +25,13 @@ import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime'; | ||
/** | ||
* @typedef {Function} AsyncCompose | ||
* @param {any} value | ||
* @param {...any} args | ||
* @returns {any} result | ||
*/ | ||
/** | ||
* Performs right-to-left function composition with async functions support | ||
* | ||
* @param {...any} functions | ||
* @param {...Function} fns functions | ||
* @returns {AsyncCompose} composed function | ||
*/ | ||
@@ -84,4 +92,4 @@ var asyncCompose = function asyncCompose() { | ||
* | ||
* @param {String} string | ||
* @returns {String} capitalized string | ||
* @param {string} value string | ||
* @returns {string} capitalized string | ||
*/ | ||
@@ -98,4 +106,5 @@ var capitalize = function capitalize(value) { | ||
* | ||
* @param {any} value | ||
* @returns {Array} casted value | ||
* @template T | ||
* @param {T|T[]} value value | ||
* @returns {T[]} array | ||
*/ | ||
@@ -108,6 +117,15 @@ var castArray = function castArray(value) { | ||
/** | ||
* @typedef {Function} Compose | ||
* @param {any} value | ||
* @param {...any} args | ||
* @returns {any} result | ||
*/ | ||
/** | ||
* Performs right-to-left function composition | ||
* | ||
* @param {...any} functions | ||
* @param {...Function} fns functions | ||
* @returns {Compose} composed function | ||
*/ | ||
@@ -181,4 +199,8 @@ var compose = function compose() { | ||
/** | ||
* @param {string | number} value | ||
* @returns {RegExpExecArray | null} match | ||
*/ | ||
var isPercent = function isPercent(value) { | ||
return /((-)?\d+\.?\d*)%/g.exec(value); | ||
return /((-)?\d+\.?\d*)%/g.exec("" + value); | ||
}; | ||
@@ -189,4 +211,4 @@ | ||
* | ||
* @param {String} value | ||
* @returns {Object} percent value (if matches) | ||
* @param {string | number} value | ||
* @returns {{ percent: number, value: number } | null} percent value (if matches) | ||
*/ | ||
@@ -196,3 +218,3 @@ var matchPercent = function matchPercent(value) { | ||
if (match) { | ||
var f = parseFloat(match[1], 10); | ||
var f = parseFloat(match[1]); | ||
var percent = f / 100; | ||
@@ -225,7 +247,18 @@ return { | ||
var repeat = function repeat(list, length) { | ||
if (length === void 0) { | ||
length = 0; | ||
} | ||
var result = new Array(length); | ||
for (var i = 0; i < length; i += 1) { | ||
result[i] = list; | ||
} | ||
return result; | ||
}; | ||
/** | ||
* Capitalize first letter of string | ||
* | ||
* @param {String} string | ||
* @returns {String} capitalized string | ||
* @param {string} value string | ||
* @returns {string} capitalized string | ||
*/ | ||
@@ -237,2 +270,2 @@ var upperFirst = function upperFirst(value) { | ||
export { adjust, asyncCompose, capitalize, castArray, compose, dropLast, evolve, get, isNil, last, mapValues, matchPercent, omit, pick, reverse, upperFirst }; | ||
export { adjust, asyncCompose, capitalize, castArray, compose, dropLast, evolve, get, isNil, last, mapValues, matchPercent, omit, pick, repeat, reverse, upperFirst }; |
{ | ||
"name": "@react-pdf/fns", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
@@ -24,3 +24,3 @@ "description": "React-pdf helper functions", | ||
"scripts": { | ||
"test": "NODE_OPTIONS=\"--experimental-vm-modules\" jest", | ||
"test": "vitest", | ||
"build": "rimraf ./lib && rollup -c", | ||
@@ -27,0 +27,0 @@ "watch": "rimraf ./lib && rollup -c -w" |
@@ -10,4 +10,5 @@ <p align="center"> | ||
## How to install | ||
```sh | ||
yarn add @react-pdf/fns | ||
``` |
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
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
15592
493
14
0