@univerjs/sheets-formula 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@univerjs/sheets-formula)](https://npmjs.org/package/@univerjs/sheets-formula)
4
4
  [![license](https://img.shields.io/npm/l/@univerjs/sheets-formula)](https://img.shields.io/npm/l/@univerjs/sheets-formula)
5
+ ![CSS Included](https://img.shields.io/badge/CSS_Included-blue?logo=CSS3)
6
+ ![i18n](https://img.shields.io/badge/zh--CN%20%7C%20en--US-cornflowerblue?label=i18n)
5
7
 
6
8
  ## Introduction
7
9
 
@@ -341,7 +343,7 @@ You can create a new `custom-function.ts` file to specifically place custom form
341
343
  */
342
344
  export class Customsum extends BaseFunction {
343
345
  override calculate(...variants: BaseValueObject[]) {
344
- let accumulatorAll: BaseValueObject = new NumberValueObject(0);
346
+ let accumulatorAll: BaseValueObject = NumberValueObject.create(0);
345
347
  for (let i = 0; i < variants.length; i++) {
346
348
  let variant = variants[i];
347
349
 
@@ -492,7 +494,7 @@ First refer to [Custom Plugin](/en-us/guides/extend/write-a-plugin/) to create a
492
494
  */
493
495
  export class Customsum extends BaseFunction {
494
496
  override calculate(...variants: BaseValueObject[]) {
495
- let accumulatorAll: BaseValueObject = new NumberValueObject(0);
497
+ let accumulatorAll: BaseValueObject = NumberValueObject.create(0);
496
498
  for (let i = 0; i < variants.length; i++) {
497
499
  let variant = variants[i];
498
500
 
@@ -704,10 +706,10 @@ To implement a formula, you need to add formula description, internationalizatio
704
706
  Location: [packages/sheets-formula/src/locale/function-list/math/en-US.ts](https://github.com/dream-num/univer/blob/dev/packages/sheets-formula/src/locale/function-list/math/en-US.ts).
705
707
 
706
708
  Internationalization is organized by category, with a file for each category. Refer to the Office function category page for a brief overview.
707
- ![office excel](./assets/img/office-excel.png)
709
+ ![office excel](./assets/office-excel.png)
708
710
 
709
711
  Refer to the Office function details page for function descriptions and parameter descriptions.
710
- ![sumif](./assets/img/sumif.png)
712
+ ![sumif](./assets/sumif.png)
711
713
 
712
714
  Most function names already have basic description, abstract, links, and parameter structures. It is recommended to modify them based on this foundation. If a function is not present, add it to the end.
713
715
 
@@ -775,10 +777,10 @@ To implement a formula, you need to add formula description, internationalizatio
775
777
  - Any formula's input and output can be `A1`, `A1:B10`, etc. When researching Excel, consider all cases, such as `=SIN(A1:B10)`, which expands to the calculated range.
776
778
  - For example, the `XLOOKUP` function requires at least one of the rows or columns of its two inputs to be of equal size for matrix calculation.
777
779
  - For example, the `SUMIF` function, although commonly used for summation, can expand based on the second parameter.
778
- ![sumif array](./assets/img/sumif-array.png)
779
- ![sumif array result](./assets/img/sumif-array-result.png)
780
+ ![sumif array](./assets/sumif-array.png)
781
+ ![sumif array result](./assets/sumif-array-result.png)
780
782
  - Excel formula calculation is becoming more like numpy, for example:
781
- ![numpy](./assets/img/numpy.png)
783
+ ![numpy](./assets/numpy.png)
782
784
  - For numerical calculations in formulas, use built-in methods and try to avoid obtaining values for manual calculation. Because formula parameters can be values, arrays, or references. You can refer to existing `sum` and `minus` functions.
783
785
  - Precision issues: The formula introduces `big.js`, and using built-in methods will call this library. However, it is nearly 100 times slower than native calculations. Therefore, for methods like `sin`, it is advisable to use native implementations.
784
786
  - For custom calculations, use the `product` function, suitable for calculating two input parameters. Call `map` to iterate over the values for changes to a parameter's own values.