cafe-utility 17.2.0 → 17.3.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.
Files changed (3) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +7 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -210,6 +210,7 @@ declare function toQueryString(object: Record<string, any>, questionMark?: boole
210
210
  declare function parseQueryString(queryString: string): Record<string, string>;
211
211
  declare function hasKey(object: Record<string, any>, key: string): boolean;
212
212
  declare function selectMax<T>(object: Record<string, T>, mapper: (item: T) => number): [string, T] | null;
213
+ declare function reposition(array: Record<string, unknown>[], key: string, current: number, delta: number): void;
213
214
  declare function buildUrl(baseUrl?: string | null, path?: string | null, query?: Record<string, any> | null): string;
214
215
  declare function parseCsv(string: string, delimiter?: string, quote?: string): string[];
215
216
  declare function humanizeProgress(state: Progress): string;
@@ -582,6 +583,7 @@ export declare const Objects: {
582
583
  parseQueryString: typeof parseQueryString;
583
584
  hasKey: typeof hasKey;
584
585
  selectMax: typeof selectMax;
586
+ reposition: typeof reposition;
585
587
  };
586
588
  export declare const Types: {
587
589
  isFunction: typeof isFunction;
package/index.js CHANGED
@@ -1145,6 +1145,11 @@ function selectMax(n, t) {
1145
1145
  }
1146
1146
  return e ? [e, n[e]] : null
1147
1147
  }
1148
+ function reposition(n, t, e, r) {
1149
+ const o = n.find(i => i[t] === e)
1150
+ o && (o[t] = e + r), n.sort((i, s) => asNumber(i[t]) - asNumber(s[t]))
1151
+ for (let i = 0; i < n.length; i++) n[i][t] = i + 1
1152
+ }
1148
1153
  function buildUrl(n, t, e) {
1149
1154
  return joinUrl(n, t) + toQueryString(e || {})
1150
1155
  }
@@ -2172,7 +2177,8 @@ function raycastCircle(n, t, e) {
2172
2177
  toQueryString,
2173
2178
  parseQueryString,
2174
2179
  hasKey,
2175
- selectMax
2180
+ selectMax,
2181
+ reposition
2176
2182
  }),
2177
2183
  (exports.Types = {
2178
2184
  isFunction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "17.2.0",
3
+ "version": "17.3.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {