@iflyrpa/share 0.0.5 → 0.0.6
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/dist/index.js +7 -0
- package/dist/index.mjs +7 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
43
43
|
semver: ()=>semver,
|
|
44
44
|
pathExists: ()=>pathExists,
|
|
45
45
|
success: ()=>success,
|
|
46
|
+
randomString: ()=>randomString,
|
|
46
47
|
ensureFile: ()=>ensureFile,
|
|
47
48
|
ensureFileSync: ()=>ensureFileSync,
|
|
48
49
|
isNil: ()=>isNil,
|
|
@@ -194,6 +195,12 @@ const success = (data, message)=>({
|
|
|
194
195
|
message: message || "发布成功",
|
|
195
196
|
data
|
|
196
197
|
});
|
|
198
|
+
const randomString = (length)=>{
|
|
199
|
+
let T = "";
|
|
200
|
+
const H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
201
|
+
for(let de = 0; de < length; de++)T += H.charAt(Math.floor(Math.random() * H.length));
|
|
202
|
+
return T;
|
|
203
|
+
};
|
|
197
204
|
var __webpack_export_target__ = exports;
|
|
198
205
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
199
206
|
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
package/dist/index.mjs
CHANGED
|
@@ -138,4 +138,10 @@ const success = (data, message)=>({
|
|
|
138
138
|
message: message || "发布成功",
|
|
139
139
|
data
|
|
140
140
|
});
|
|
141
|
-
|
|
141
|
+
const randomString = (length)=>{
|
|
142
|
+
let T = "";
|
|
143
|
+
const H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
144
|
+
for(let de = 0; de < length; de++)T += H.charAt(Math.floor(Math.random() * H.length));
|
|
145
|
+
return T;
|
|
146
|
+
};
|
|
147
|
+
export { downloadImage, ensureFile, ensureFileSync, fetchJSON, getFilenameFromUrl, isNil, pathExists, randomString, semver, sleep, success, writeFile };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResponseData } from "./types";
|
|
1
|
+
import type { ResponseData } from "./types";
|
|
2
2
|
export declare function pathExists(path: string): Promise<unknown>;
|
|
3
3
|
export declare function ensureFileSync(filePath: string): void;
|
|
4
4
|
export declare function writeFile(filePath: string, data: string): Promise<void>;
|
|
@@ -12,3 +12,4 @@ export declare function downloadImage(url: string, savePath: string): Promise<st
|
|
|
12
12
|
export declare function getFilenameFromUrl(imageUrl: string): string;
|
|
13
13
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
14
14
|
export declare const success: <T>(data: T, message?: string) => ResponseData<T>;
|
|
15
|
+
export declare const randomString: (length: number) => string;
|