@thi.ng/ramp 3.1.33 → 3.2.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-08-18T14:11:34Z
3
+ - **Last updated**: 2024-08-28T14:01:19Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [3.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/ramp@3.2.0) (2024-08-28)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add IRamp.removeStopAtIndex() ([05c965f](https://github.com/thi-ng/umbrella/commit/05c965f))
17
+
12
18
  ### [3.1.24](https://github.com/thi-ng/umbrella/tree/@thi.ng/ramp@3.1.24) (2024-06-21)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -70,7 +70,7 @@ For Node.js REPL:
70
70
  const ramp = await import("@thi.ng/ramp");
71
71
  ```
72
72
 
73
- Package sizes (brotli'd, pre-treeshake): ESM: 1.87 KB
73
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.89 KB
74
74
 
75
75
  ## Dependencies
76
76
 
package/api.d.ts CHANGED
@@ -48,6 +48,7 @@ export interface IRamp<T> extends IReadonlyRamp<T> {
48
48
  stops: Frame<T>[];
49
49
  setStopAt(t: number, y: T, eps?: number): boolean;
50
50
  removeStopAt(t: number, eps?: number): boolean;
51
+ removeStopAtIndex(i: number): boolean;
51
52
  closestIndex(t: number, eps?: number): number;
52
53
  clampedIndexTime(i: number, t: number, eps?: number): number;
53
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/ramp",
3
- "version": "3.1.33",
3
+ "version": "3.2.0",
4
4
  "description": "Extensible keyframe interpolation/tweening of arbitrary, nested types",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -40,9 +40,9 @@
40
40
  "@thi.ng/arrays": "^2.10.0",
41
41
  "@thi.ng/compare": "^2.4.1",
42
42
  "@thi.ng/errors": "^2.5.15",
43
- "@thi.ng/math": "^5.11.8",
44
- "@thi.ng/transducers": "^9.1.1",
45
- "@thi.ng/vectors": "^7.11.9"
43
+ "@thi.ng/math": "^5.11.9",
44
+ "@thi.ng/transducers": "^9.2.1",
45
+ "@thi.ng/vectors": "^7.11.11"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@microsoft/api-extractor": "^7.47.5",
@@ -117,5 +117,5 @@
117
117
  "thi.ng": {
118
118
  "year": 2019
119
119
  },
120
- "gitHead": "f6e26ea1142525171de5d36b9c3119f2782bb437\n"
120
+ "gitHead": "502a0192bae48e69290870ea8a2767f8b81adee6\n"
121
121
  }
package/ramp.d.ts CHANGED
@@ -31,6 +31,7 @@ export declare class Ramp<T> implements ICopy<IRamp<T>>, IEmpty<IRamp<T>>, IRamp
31
31
  timeBounds(): [number, number];
32
32
  setStopAt(t: number, val: T, eps?: number): boolean;
33
33
  removeStopAt(t: number, eps?: number): boolean;
34
+ removeStopAtIndex(i: number): boolean;
34
35
  closestIndex(t: number, eps?: number): number;
35
36
  clampedIndexTime(i: number, t: number, eps?: number): number;
36
37
  sort(): void;
package/ramp.js CHANGED
@@ -78,14 +78,13 @@ class Ramp {
78
78
  return false;
79
79
  }
80
80
  removeStopAt(t, eps = 0.01) {
81
- if (this.stops.length > 2) {
82
- const i = this.closestIndex(t, eps);
83
- if (i !== -1) {
84
- this.stops.splice(i, 1);
85
- return true;
86
- }
87
- }
88
- return false;
81
+ return this.stops.length > 2 ? this.removeStopAtIndex(this.closestIndex(t, eps)) : false;
82
+ }
83
+ removeStopAtIndex(i) {
84
+ const stops = this.stops;
85
+ if (i < 0 || i >= stops.length || stops.length <= 2) return false;
86
+ stops.splice(i, 1);
87
+ return true;
89
88
  }
90
89
  closestIndex(t, eps = 0.01) {
91
90
  const stops = this.stops;