@ribbon-studios/js-utils 2.0.0 → 2.1.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/README.md CHANGED
@@ -26,7 +26,7 @@ Collection of generic javascript utilities curated by the Ribbon Studios Team~
26
26
  - [`rfetch.put`](#rfetchput)
27
27
  - [`rfetch.post`](#rfetchpost)
28
28
  - [`rfetch.patch`](#rfetchpatch)
29
- - [`rfetch.remove`](#rfetchremove)
29
+ - [`rfetch.delete`](#rfetchdelete)
30
30
  - [`rfetch.interceptors`](#rfetchinterceptors)
31
31
  - [`rfetch.delimiters`](#rfetchdelimiters)
32
32
 
@@ -195,7 +195,7 @@ import { rfetch, type RibbonFetchError } from '@ribbon-studios/js-utils';
195
195
  await rfetch.patch<MyExpectedResponse>('https://ribbonstudios.com');
196
196
  ```
197
197
 
198
- ### `rfetch.remove`
198
+ ### `rfetch.delete`
199
199
 
200
200
  Shorthand for DELETE requests.
201
201
 
@@ -203,7 +203,7 @@ Shorthand for DELETE requests.
203
203
  import { rfetch, type RibbonFetchError } from '@ribbon-studios/js-utils';
204
204
 
205
205
  // Shorthand for DELETE requests.
206
- await rfetch.remove<MyExpectedResponse>('https://ribbonstudios.com');
206
+ await rfetch.delete<MyExpectedResponse>('https://ribbonstudios.com');
207
207
  ```
208
208
 
209
209
  ### `rfetch.interceptors`
package/dist/index.cjs CHANGED
@@ -113,6 +113,12 @@ async function rfetch(url, { params, body, ...options } = {}) {
113
113
  })
114
114
  );
115
115
  }
116
+ rfetch.delete = (url, options) => {
117
+ return rfetch(url, {
118
+ ...options,
119
+ method: "DELETE"
120
+ });
121
+ };
116
122
  ((rfetch2) => {
117
123
  async function get(url, options) {
118
124
  return rfetch2(url, {
@@ -143,10 +149,7 @@ async function rfetch(url, { params, body, ...options } = {}) {
143
149
  }
144
150
  rfetch2.patch = patch;
145
151
  async function remove(url, options) {
146
- return rfetch2(url, {
147
- ...options,
148
- method: "DELETE"
149
- });
152
+ return rfetch2.delete(url, options);
150
153
  }
151
154
  rfetch2.remove = remove;
152
155
  async function delimiters(type) {
package/dist/index.js CHANGED
@@ -111,6 +111,12 @@ async function rfetch(url, { params, body, ...options } = {}) {
111
111
  })
112
112
  );
113
113
  }
114
+ rfetch.delete = (url, options) => {
115
+ return rfetch(url, {
116
+ ...options,
117
+ method: "DELETE"
118
+ });
119
+ };
114
120
  ((rfetch2) => {
115
121
  async function get(url, options) {
116
122
  return rfetch2(url, {
@@ -141,10 +147,7 @@ async function rfetch(url, { params, body, ...options } = {}) {
141
147
  }
142
148
  rfetch2.patch = patch;
143
149
  async function remove(url, options) {
144
- return rfetch2(url, {
145
- ...options,
146
- method: "DELETE"
147
- });
150
+ return rfetch2.delete(url, options);
148
151
  }
149
152
  rfetch2.remove = remove;
150
153
  async function delimiters(type) {
package/dist/rfetch.d.ts CHANGED
@@ -27,6 +27,10 @@ export declare enum DelimiterType {
27
27
  * @returns The typed response or an error containing the `status` and the `content`
28
28
  */
29
29
  export declare function rfetch<T = any>(url: string | URL, { params, body, ...options }?: RibbonFetchOptions): Promise<T>;
30
+ export declare namespace rfetch {
31
+ var _a: <T>(url: string | URL, options?: RibbonFetchBodyOptions) => Promise<T>;
32
+ export { _a as delete };
33
+ }
30
34
  export declare namespace rfetch {
31
35
  /**
32
36
  * Shorthand method for a GET request
@@ -66,7 +70,7 @@ export declare namespace rfetch {
66
70
  * @param url The url you wish to fetch.
67
71
  * @param options The request options.
68
72
  * @returns The typed response or an error containing the `status` and the `content`
69
- * @note This is named `remove` purely because `delete` is a reserved key
73
+ * @deprecated in favor of {@link rfetch.delete}
70
74
  */
71
75
  function remove<T>(url: string | URL, options?: RibbonFetchBodyOptions): Promise<T>;
72
76
  function delimiters(type: DelimiterType): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ribbon-studios/js-utils",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Collection of generic javascript utilities curated by the Rainbow Cafe~",
5
5
  "type": "module",
6
6
  "source": "src/*.ts",