@visactor/vutils 0.19.5 → 0.19.7

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.
Files changed (78) hide show
  1. package/README.md +5 -12
  2. package/cjs/common/ascending.js +2 -1
  3. package/cjs/common/extent.d.ts +1 -0
  4. package/cjs/common/extent.js +30 -0
  5. package/cjs/common/extent.js.map +1 -0
  6. package/cjs/common/field.d.ts +12 -0
  7. package/cjs/common/field.js +35 -0
  8. package/cjs/common/field.js.map +1 -0
  9. package/cjs/common/index.d.ts +5 -0
  10. package/cjs/common/index.js +3 -1
  11. package/cjs/common/index.js.map +1 -1
  12. package/cjs/common/isArrayLike.js +2 -1
  13. package/cjs/common/isNumber.js +1 -2
  14. package/cjs/common/isShallowEqual.js +2 -1
  15. package/cjs/common/isString.js +1 -1
  16. package/cjs/common/isType.js +1 -1
  17. package/cjs/common/isUndefined.js +1 -1
  18. package/cjs/common/isValid.js +1 -1
  19. package/cjs/common/isValidNumber.js +1 -1
  20. package/cjs/common/isValidUrl.js +1 -1
  21. package/cjs/common/lowerFirst.js +1 -1
  22. package/cjs/common/random.d.ts +2 -0
  23. package/cjs/common/random.js +18 -1
  24. package/cjs/common/random.js.map +1 -1
  25. package/cjs/common/regression-linear.d.ts +8 -0
  26. package/cjs/common/regression-linear.js +50 -0
  27. package/cjs/common/regression-linear.js.map +1 -0
  28. package/cjs/common/toPercent.d.ts +1 -0
  29. package/cjs/common/toPercent.js +17 -0
  30. package/cjs/common/toPercent.js.map +1 -0
  31. package/cjs/common/zero.d.ts +1 -0
  32. package/cjs/common/zero.js +10 -0
  33. package/cjs/common/zero.js.map +1 -0
  34. package/cjs/data-structure/bounds.js +1 -1
  35. package/cjs/data-structure/hashTable.js +1 -2
  36. package/cjs/data-structure/index.js +1 -1
  37. package/cjs/data-structure/matrix.js +1 -1
  38. package/cjs/data-structure/point.js +1 -1
  39. package/dist/index.js +145 -2
  40. package/dist/index.min.js +1 -1
  41. package/es/common/ascending.js +2 -1
  42. package/es/common/extent.d.ts +1 -0
  43. package/es/common/extent.js +21 -0
  44. package/es/common/extent.js.map +1 -0
  45. package/es/common/field.d.ts +12 -0
  46. package/es/common/field.js +23 -0
  47. package/es/common/field.js.map +1 -0
  48. package/es/common/index.d.ts +5 -0
  49. package/es/common/index.js +10 -0
  50. package/es/common/index.js.map +1 -1
  51. package/es/common/isArrayLike.js +2 -1
  52. package/es/common/isNumber.js +1 -2
  53. package/es/common/isShallowEqual.js +2 -1
  54. package/es/common/isString.js +1 -1
  55. package/es/common/isType.js +1 -1
  56. package/es/common/isUndefined.js +1 -1
  57. package/es/common/isValid.js +1 -1
  58. package/es/common/isValidNumber.js +1 -1
  59. package/es/common/isValidUrl.js +1 -1
  60. package/es/common/lowerFirst.js +1 -1
  61. package/es/common/random.d.ts +2 -0
  62. package/es/common/random.js +13 -0
  63. package/es/common/random.js.map +1 -1
  64. package/es/common/regression-linear.d.ts +8 -0
  65. package/es/common/regression-linear.js +35 -0
  66. package/es/common/regression-linear.js.map +1 -0
  67. package/es/common/toPercent.d.ts +1 -0
  68. package/es/common/toPercent.js +6 -0
  69. package/es/common/toPercent.js.map +1 -0
  70. package/es/common/zero.d.ts +1 -0
  71. package/es/common/zero.js +2 -0
  72. package/es/common/zero.js.map +1 -0
  73. package/es/data-structure/bounds.js +1 -1
  74. package/es/data-structure/hashTable.js +1 -2
  75. package/es/data-structure/index.js +1 -1
  76. package/es/data-structure/matrix.js +1 -1
  77. package/es/data-structure/point.js +1 -1
  78. package/package.json +6 -3
@@ -57,3 +57,8 @@ export { default as lowerFirst } from './lowerFirst';
57
57
  export { default as upperFirst } from './upperFirst';
58
58
  export { default as substitute } from './substitute';
59
59
  export * from './random';
60
+ export * from './field';
61
+ export * from './toPercent';
62
+ export * from './zero';
63
+ export * from './extent';
64
+ export * from './regression-linear';
@@ -115,4 +115,14 @@ export { default as upperFirst } from "./upperFirst";
115
115
  export { default as substitute } from "./substitute";
116
116
 
117
117
  export * from "./random";
118
+
119
+ export * from "./field";
120
+
121
+ export * from "./toPercent";
122
+
123
+ export * from "./zero";
124
+
125
+ export * from "./extent";
126
+
127
+ export * from "./regression-linear";
118
128
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,C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,YAAY,CAAC;AAGtC,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGjD,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["// type check\nexport { default as isBoolean } from './isBoolean';\nexport { default as isFunction } from './isFunction';\nexport { default as isNil } from './isNil';\nexport { default as isNull } from './isNull';\nexport { default as isValid } from './isValid';\nexport { default as isObject } from './isObject';\nexport { default as isObjectLike } from './isObjectLike';\nexport { default as isPlainObject } from './isPlainObject';\nexport { default as isType } from './isType';\nexport { default as isUndefined } from './isUndefined';\nexport { default as isString } from './isString';\nexport { default as isArray } from './isArray';\nexport { default as isArrayLike } from './isArrayLike';\nexport { default as isDate } from './isDate';\nexport { default as isNumber } from './isNumber';\nexport { default as isNumeric } from './isNumeric';\nexport { default as isValidNumber } from './isValidNumber';\nexport { default as isValidUrl } from './isValidUrl';\nexport { default as isRegExp } from './isRegExp';\nexport { default as isBase64 } from './isBase64';\n\nexport { default as isEmpty } from './isEmpty';\n\n// object\nexport { default as get } from './get';\nexport { default as has } from './has';\nexport { default as clone } from './clone';\nexport { default as cloneDeep } from './cloneDeep';\nexport { default as merge, baseMerge } from './merge';\nexport { default as pick } from './pick';\nexport { default as pickWithout } from './pickWithout';\nexport { isEqual } from './isEqual';\nexport { isShallowEqual } from './isShallowEqual';\nexport * from './mixin';\n\n// array\nexport * from './array';\nexport { range } from './range';\nexport { ascending } from './ascending';\nexport * from './quantileSorted';\nexport { bisect, findZeroOfFunction, binaryFuzzySearch, binaryFuzzySearchInNumberRange } from './bisect';\nexport { deviation } from './deviation';\nexport { median } from './median';\nexport { variance } from './variance';\n\n// tick\nexport { tickStep } from './tickStep';\n\n// number\nexport * from './number';\n\n// function\nexport { default as constant } from './constant';\nexport { memoize } from './memoize';\n\n// pad\nexport { default as pad } from './pad';\nexport { default as truncate } from './truncate';\n\n// uuid\nexport { default as uuid } from './uuid';\n\n// clamp\nexport { default as clamp } from './clamp';\nexport { default as clampRange } from './clampRange';\nexport { clamper } from './clamper';\n\n// debounce & throttle\nexport { default as debounce } from './debounce';\nexport { default as throttle } from './throttle';\n\n// interpolate\nexport * from './interpolate';\n\n// type convert\nexport { toDate } from './toDate';\nexport { toNumber } from './toNumber';\nexport { toValidNumber } from './toValidNumber';\n\n// string\nexport { default as lowerFirst } from './lowerFirst';\nexport { default as upperFirst } from './upperFirst';\n\n// string format\nexport { default as substitute } from './substitute';\n\nexport * from './random';\n"]}
1
+ {"version":3,"sources":["../src/common/index.ts"],"names":[],"mappings":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AM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGjD,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC","file":"index.js","sourcesContent":["// type check\nexport { default as isBoolean } from './isBoolean';\nexport { default as isFunction } from './isFunction';\nexport { default as isNil } from './isNil';\nexport { default as isNull } from './isNull';\nexport { default as isValid } from './isValid';\nexport { default as isObject } from './isObject';\nexport { default as isObjectLike } from './isObjectLike';\nexport { default as isPlainObject } from './isPlainObject';\nexport { default as isType } from './isType';\nexport { default as isUndefined } from './isUndefined';\nexport { default as isString } from './isString';\nexport { default as isArray } from './isArray';\nexport { default as isArrayLike } from './isArrayLike';\nexport { default as isDate } from './isDate';\nexport { default as isNumber } from './isNumber';\nexport { default as isNumeric } from './isNumeric';\nexport { default as isValidNumber } from './isValidNumber';\nexport { default as isValidUrl } from './isValidUrl';\nexport { default as isRegExp } from './isRegExp';\nexport { default as isBase64 } from './isBase64';\n\nexport { default as isEmpty } from './isEmpty';\n\n// object\nexport { default as get } from './get';\nexport { default as has } from './has';\nexport { default as clone } from './clone';\nexport { default as cloneDeep } from './cloneDeep';\nexport { default as merge, baseMerge } from './merge';\nexport { default as pick } from './pick';\nexport { default as pickWithout } from './pickWithout';\nexport { isEqual } from './isEqual';\nexport { isShallowEqual } from './isShallowEqual';\nexport * from './mixin';\n\n// array\nexport * from './array';\nexport { range } from './range';\nexport { ascending } from './ascending';\nexport * from './quantileSorted';\nexport { bisect, findZeroOfFunction, binaryFuzzySearch, binaryFuzzySearchInNumberRange } from './bisect';\nexport { deviation } from './deviation';\nexport { median } from './median';\nexport { variance } from './variance';\n\n// tick\nexport { tickStep } from './tickStep';\n\n// number\nexport * from './number';\n\n// function\nexport { default as constant } from './constant';\nexport { memoize } from './memoize';\n\n// pad\nexport { default as pad } from './pad';\nexport { default as truncate } from './truncate';\n\n// uuid\nexport { default as uuid } from './uuid';\n\n// clamp\nexport { default as clamp } from './clamp';\nexport { default as clampRange } from './clampRange';\nexport { clamper } from './clamper';\n\n// debounce & throttle\nexport { default as debounce } from './debounce';\nexport { default as throttle } from './throttle';\n\n// interpolate\nexport * from './interpolate';\n\n// type convert\nexport { toDate } from './toDate';\nexport { toNumber } from './toNumber';\nexport { toValidNumber } from './toValidNumber';\n\n// string\nexport { default as lowerFirst } from './lowerFirst';\nexport { default as upperFirst } from './upperFirst';\n\n// string format\nexport { default as substitute } from './substitute';\n\nexport * from './random';\nexport * from './field';\nexport * from './toPercent';\nexport * from './zero';\nexport * from './extent';\nexport * from './regression-linear';\n"]}
@@ -2,4 +2,5 @@ const isArrayLike = function(value) {
2
2
  return null !== value && "function" != typeof value && Number.isFinite(value.length);
3
3
  };
4
4
 
5
- export default isArrayLike;
5
+ export default isArrayLike;
6
+ //# sourceMappingURL=isArrayLike.js.map
@@ -5,5 +5,4 @@ const isNumber = (value, fuzzy = !1) => {
5
5
  return fuzzy ? "number" === type : "number" === type || isType(value, "Number");
6
6
  };
7
7
 
8
- export default isNumber;
9
- //# sourceMappingURL=isNumber.js.map
8
+ export default isNumber;
@@ -18,4 +18,5 @@ export function isShallowEqual(objA, objB) {
18
18
  let ret = !0;
19
19
  return Object.keys(objA).forEach((k => !!is(objA[k], objB[k]) || (ret = !1, ret))),
20
20
  ret;
21
- }
21
+ }
22
+ //# sourceMappingURL=isShallowEqual.js.map
@@ -6,4 +6,4 @@ const isString = (value, fuzzy = !1) => {
6
6
  };
7
7
 
8
8
  export default isString;
9
- //# sourceMappingURL=isString.js.map
9
+ //# sourceMappingURL=isString.js.map
@@ -1,4 +1,4 @@
1
1
  const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
2
2
 
3
3
  export default isType;
4
- //# sourceMappingURL=isType.js.map
4
+ //# sourceMappingURL=isType.js.map
@@ -1,4 +1,4 @@
1
1
  const isUndefined = value => void 0 === value;
2
2
 
3
3
  export default isUndefined;
4
- //# sourceMappingURL=isUndefined.js.map
4
+ //# sourceMappingURL=isUndefined.js.map
@@ -1,4 +1,4 @@
1
1
  const isValid = value => null != value;
2
2
 
3
3
  export default isValid;
4
- //# sourceMappingURL=isValid.js.map
4
+ //# sourceMappingURL=isValid.js.map
@@ -3,4 +3,4 @@ import isNumber from "./isNumber";
3
3
  const isValidNumber = value => isNumber(value) && Number.isFinite(value);
4
4
 
5
5
  export default isValidNumber;
6
- //# sourceMappingURL=isValidNumber.js.map
6
+ //# sourceMappingURL=isValidNumber.js.map
@@ -1,4 +1,4 @@
1
1
  export const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
2
2
 
3
3
  export default isValidUrl;
4
- //# sourceMappingURL=isValidUrl.js.map
4
+ //# sourceMappingURL=isValidUrl.js.map
@@ -3,4 +3,4 @@ const lowerFirst = function(str) {
3
3
  };
4
4
 
5
5
  export default lowerFirst;
6
- //# sourceMappingURL=lowerFirst.js.map
6
+ //# sourceMappingURL=lowerFirst.js.map
@@ -1 +1,3 @@
1
1
  export declare function seedRandom(seed: number): number;
2
+ export declare function randomLCG(initS?: number): () => number;
3
+ export declare const fakeRandom: () => () => number;
@@ -1,4 +1,17 @@
1
1
  export function seedRandom(seed) {
2
2
  return parseFloat("0." + Math.sin(seed).toString().substring(6));
3
3
  }
4
+
5
+ const a = 1664525, c = 1013904223, m = 4294967296;
6
+
7
+ export function randomLCG(initS = 1) {
8
+ let s = initS;
9
+ return () => (s = (a * s + c) % m) / m;
10
+ }
11
+
12
+ export const fakeRandom = () => {
13
+ let i = -1;
14
+ const arr = [ 0, .1, .2, .3, .4, .5, .6, .7, .8, .9 ];
15
+ return () => (i = (i + 1) % arr.length, arr[i]);
16
+ };
4
17
  //# sourceMappingURL=random.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/random.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC","file":"random.js","sourcesContent":["export function seedRandom(seed: number) {\n return parseFloat('0.' + Math.sin(seed).toString().substring(6));\n}\n"]}
1
+ {"version":3,"sources":["../src/common/random.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AAYD,MAAM,CAAC,GAAG,OAAO,CAAC;AAClB,MAAM,CAAC,GAAG,UAAU,CAAC;AACrB,MAAM,CAAC,GAAG,UAAU,CAAC;AAErB,MAAM,UAAU,SAAS,CAAC,QAAgB,CAAC;IACzC,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAKD,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACX,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC7D,OAAO,GAAG,EAAE;QACV,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC","file":"random.js","sourcesContent":["export function seedRandom(seed: number) {\n return parseFloat('0.' + Math.sin(seed).toString().substring(6));\n}\n\n/* Adapted from vega by University of Washington Interactive Data Lab\n * https://vega.github.io/vega/\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/vega/vega/blob/main/packages/vega-statistics/src/lcg.js\n * License: https://github.com/vega/vega/blob/main/LICENSE\n * @license\n */\n\n// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use\nconst a = 1664525;\nconst c = 1013904223;\nconst m = 4294967296; // 2^32\n\nexport function randomLCG(initS: number = 1) {\n let s = initS;\n return () => (s = (a * s + c) % m) / m;\n}\n\n/**\n * 随机拟合\n */\nexport const fakeRandom = () => {\n let i = -1;\n const arr = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];\n return () => {\n i = (i + 1) % arr.length;\n return arr[i];\n };\n};\n"]}
@@ -0,0 +1,8 @@
1
+ export declare function ordinaryLeastSquares(uX: number, uY: number, uXY: number, uX2: number): number[];
2
+ export declare function visitPoints(data: any[], x: (datum: any) => number, y: (datum: any) => number, callback: (x: number, y: number, index: number) => void): void;
3
+ export declare function rSquared(data: any[], x: (datum: any) => number, y: (datum: any) => number, uY: number, predict: (x: number) => number): number;
4
+ export declare function regressionLinear(data: any[], x?: (datum: any) => number, y?: (datum: any) => number): {
5
+ coef: number[];
6
+ predict: (x: number) => number;
7
+ rSquared: number;
8
+ };
@@ -0,0 +1,35 @@
1
+ import isNil from "./isNil";
2
+
3
+ export function ordinaryLeastSquares(uX, uY, uXY, uX2) {
4
+ const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta;
5
+ return [ uY - slope * uX, slope ];
6
+ }
7
+
8
+ export function visitPoints(data, x, y, callback) {
9
+ let u, v, i = -1;
10
+ data.forEach((d => {
11
+ u = x(d), v = y(d), !isNil(u) && (u = +u) >= u && !isNil(v) && (v = +v) >= v && callback(u, v, ++i);
12
+ }));
13
+ }
14
+
15
+ export function rSquared(data, x, y, uY, predict) {
16
+ let SSE = 0, SST = 0;
17
+ return visitPoints(data, x, y, ((dx, dy) => {
18
+ const sse = dy - predict(dx), sst = dy - uY;
19
+ SSE += sse * sse, SST += sst * sst;
20
+ })), 1 - SSE / SST;
21
+ }
22
+
23
+ export function regressionLinear(data, x = (datum => datum.x), y = (datum => datum.y)) {
24
+ let X = 0, Y = 0, XY = 0, X2 = 0, n = 0;
25
+ visitPoints(data, x, y, ((dx, dy) => {
26
+ ++n, X += (dx - X) / n, Y += (dy - Y) / n, XY += (dx * dy - XY) / n, X2 += (dx * dx - X2) / n;
27
+ }));
28
+ const coef = ordinaryLeastSquares(X, Y, XY, X2), predict = x => coef[0] + coef[1] * x;
29
+ return {
30
+ coef: coef,
31
+ predict: predict,
32
+ rSquared: rSquared(data, x, y, Y, predict)
33
+ };
34
+ }
35
+ //# sourceMappingURL=regression-linear.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/regression-linear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAS5B,MAAM,UAAU,oBAAoB,CAAC,EAAU,EAAE,EAAU,EAAE,GAAW,EAAE,GAAW;IACnF,MAAM,KAAK,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IACpE,MAAM,SAAS,GAAG,EAAE,GAAG,KAAK,GAAG,EAAE,CAAC;IAElC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC;AAID,MAAM,UAAU,WAAW,CACzB,IAAW,EACX,CAAyB,EACzB,CAAyB,EACzB,QAAuD;IAEvD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACX,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,CAAC;IAEN,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACf,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE;YAC5D,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAID,MAAM,U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C,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,oBAAoB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAErD,OAAO;QACL,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;KAC3C,CAAC;AACJ,CAAC","file":"regression-linear.js","sourcesContent":["import isNil from './isNil';\n/* Adapted from vega by University of Washington Interactive Data Lab\n * https://vega.github.io/vega/\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/vega/vega/blob/main/packages/vega-statistics/src/regression/ols.js\n * License: https://github.com/vega/vega/blob/main/LICENSE\n * @license\n */\nexport function ordinaryLeastSquares(uX: number, uY: number, uXY: number, uX2: number) {\n const delta = uX2 - uX * uX;\n const slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta;\n const intercept = uY - slope * uX;\n\n return [intercept, slope];\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nexport function visitPoints(\n data: any[],\n x: (datum: any) => number,\n y: (datum: any) => number,\n callback: (x: number, y: number, index: number) => void\n) {\n let i = -1;\n let u;\n let v;\n\n data.forEach(d => {\n u = x(d);\n v = y(d);\n if (!isNil(u) && (u = +u) >= u && !isNil(v) && (v = +v) >= v) {\n callback(u, v, ++i);\n }\n });\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nexport function rSquared(\n data: any[],\n x: (datum: any) => number,\n y: (datum: any) => number,\n uY: number,\n predict: (x: number) => number\n) {\n let SSE = 0;\n let SST = 0;\n\n visitPoints(data, x, y, (dx, dy) => {\n const sse = dy - predict(dx);\n const sst = dy - uY;\n\n SSE += sse * sse;\n SST += sst * sst;\n });\n\n return 1 - SSE / SST;\n}\n\n// Adapted from d3-regression by Harry Stevens\n// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE\nexport function regressionLinear(\n data: any[],\n x: (datum: any) => number = datum => datum.x,\n y: (datum: any) => number = datum => datum.y\n) {\n let X = 0;\n let Y = 0;\n let XY = 0;\n let X2 = 0;\n let n = 0;\n\n visitPoints(data, x, y, (dx, dy) => {\n ++n;\n X += (dx - X) / n;\n Y += (dy - Y) / n;\n XY += (dx * dy - XY) / n;\n X2 += (dx * dx - X2) / n;\n });\n\n const coef = ordinaryLeastSquares(X, Y, XY, X2);\n const predict = (x: number) => coef[0] + coef[1] * x;\n\n return {\n coef: coef,\n predict: predict,\n rSquared: rSquared(data, x, y, Y, predict)\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const toPercent: (percent: string | number, total: number) => number;
@@ -0,0 +1,6 @@
1
+ import isNil from "./isNil";
2
+
3
+ import isString from "./isString";
4
+
5
+ export const toPercent = (percent, total) => isNil(percent) ? total : isString(percent) ? total * parseFloat(percent) / 100 : percent;
6
+ //# sourceMappingURL=toPercent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/toPercent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAwB,EAAE,KAAa,EAAE,EAAE;IACnE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC;KACd;IAED,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,OAAiB,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;AACrF,CAAC,CAAC","file":"toPercent.js","sourcesContent":["import isNil from './isNil';\nimport isString from './isString';\n\nexport const toPercent = (percent: string | number, total: number) => {\n if (isNil(percent)) {\n return total;\n }\n\n return isString(percent) ? (total * parseFloat(percent as string)) / 100 : percent;\n};\n"]}
@@ -0,0 +1 @@
1
+ export declare const zero: (_: any) => number;
@@ -0,0 +1,2 @@
1
+ export const zero = _ => 0;
2
+ //# sourceMappingURL=zero.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/common/zero.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC","file":"zero.js","sourcesContent":["export const zero = (_: any) => 0;\n"]}
@@ -159,4 +159,4 @@ export class OBBBounds extends Bounds {
159
159
  }, this.angle, originPoint) ];
160
160
  }
161
161
  }
162
- //# sourceMappingURL=bounds.js.map
162
+ //# sourceMappingURL=bounds.js.map
@@ -101,5 +101,4 @@ export class HashTable {
101
101
  return returnArr;
102
102
  }
103
103
  toImmutableMap() {}
104
- }
105
- //# sourceMappingURL=hashTable.js.map
104
+ }
@@ -5,4 +5,4 @@ export * from "./point";
5
5
  export * from "./bounds";
6
6
 
7
7
  export * from "./matrix";
8
- //# sourceMappingURL=index.js.map
8
+ //# sourceMappingURL=index.js.map
@@ -103,4 +103,4 @@ export function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotate
103
103
  out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY,
104
104
  out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
105
105
  }
106
- //# sourceMappingURL=matrix.js.map
106
+ //# sourceMappingURL=matrix.js.map
@@ -62,4 +62,4 @@ export class PolarPoint {
62
62
  return this.r = r, this.theta = theta, this;
63
63
  }
64
64
  }
65
- //# sourceMappingURL=point.js.map
65
+ //# sourceMappingURL=point.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vutils",
3
- "version": "0.19.5",
3
+ "version": "0.19.7",
4
4
  "main": "cjs/index.js",
5
5
  "module": "es/index.js",
6
6
  "types": "es/index.d.ts",
@@ -10,7 +10,10 @@
10
10
  "dist"
11
11
  ],
12
12
  "description": "util",
13
- "author": "dp-fe",
13
+ "author": {
14
+ "name": "VisActor",
15
+ "url": "https://VisActor.io/"
16
+ },
14
17
  "license": "MIT",
15
18
  "keywords": [
16
19
  "visual",
@@ -28,8 +31,8 @@
28
31
  "typescript": "4.9.5",
29
32
  "@types/node": "*",
30
33
  "@internal/bundler": "0.0.1",
31
- "@internal/ts-config": "0.0.1",
32
34
  "@internal/eslint-config": "0.0.1",
35
+ "@internal/ts-config": "0.0.1",
33
36
  "@internal/jest-config": "0.0.1"
34
37
  },
35
38
  "dependencies": {