@discordeno/utils 19.0.0-next.782a778 → 19.0.0-next.7b5d99e
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.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/files.d.ts +0 -4
- package/dist/files.d.ts.map +0 -1
- package/dist/files.js +0 -41
- package/dist/files.js.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './base64.js'\nexport * from './bucket.js'\nexport * from './casing.js'\nexport * from './Collection.js'\nexport * from './colors.js'\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './base64.js'\nexport * from './bucket.js'\nexport * from './casing.js'\nexport * from './Collection.js'\nexport * from './colors.js'\nexport * from './hash.js'\nexport * from './images.js'\nexport * from './logger.js'\nexport * from './permissions.js'\nexport * from './reactions.js'\nexport * from './token.js'\nexport * from './typeguards.js'\nexport * from './urlToBase64.js'\nexport * from './utils.js'\n"],"names":[],"mappings":"AAAA,cAAc,cAAa;AAC3B,cAAc,cAAa;AAC3B,cAAc,cAAa;AAC3B,cAAc,kBAAiB;AAC/B,cAAc,cAAa;AAC3B,cAAc,YAAW;AACzB,cAAc,cAAa;AAC3B,cAAc,cAAa;AAC3B,cAAc,mBAAkB;AAChC,cAAc,iBAAgB;AAC9B,cAAc,aAAY;AAC1B,cAAc,kBAAiB;AAC/B,cAAc,mBAAkB;AAChC,cAAc,aAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discordeno/utils",
|
|
3
|
-
"version": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.7b5d99e",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test:test-type": "tsc --project tsconfig.test.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@discordeno/types": "19.0.0-next.
|
|
26
|
+
"@discordeno/types": "19.0.0-next.7b5d99e",
|
|
27
27
|
"node-fetch": "^3.3.1",
|
|
28
28
|
"tweetnacl": "^1.0.3"
|
|
29
29
|
},
|
package/dist/files.d.ts
DELETED
package/dist/files.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGpD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,EAAE,CAOtD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAyBxE"}
|
package/dist/files.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { decode } from './base64.js';
|
|
2
|
-
export function findFiles(file) {
|
|
3
|
-
if (!file) {
|
|
4
|
-
return [];
|
|
5
|
-
}
|
|
6
|
-
const files = Array.isArray(file) ? file : [
|
|
7
|
-
file
|
|
8
|
-
];
|
|
9
|
-
return files.filter(coerceToFileContent);
|
|
10
|
-
}
|
|
11
|
-
export function coerceToFileContent(value) {
|
|
12
|
-
if (!value || typeof value !== 'object') {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
const file = value;
|
|
16
|
-
if (typeof file.name !== 'string') {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
switch(typeof file.blob){
|
|
20
|
-
case 'string':
|
|
21
|
-
{
|
|
22
|
-
const match = file.blob.match(/^data:(?<mimeType>[a-zA-Z0-9/]*);base64,(?<content>.*)$/);
|
|
23
|
-
if (match?.groups === undefined) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
const { mimeType , content } = match.groups;
|
|
27
|
-
file.blob = new Blob([
|
|
28
|
-
decode(content)
|
|
29
|
-
], {
|
|
30
|
-
type: mimeType
|
|
31
|
-
});
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
case 'object':
|
|
35
|
-
return file.blob instanceof Blob;
|
|
36
|
-
default:
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=files.js.map
|
package/dist/files.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/files.ts"],"sourcesContent":["import type { FileContent } from '@discordeno/types'\nimport { decode } from './base64.js'\n\nexport function findFiles(file: unknown): FileContent[] {\n if (!file) {\n return []\n }\n\n const files: unknown[] = Array.isArray(file) ? file : [file]\n return files.filter(coerceToFileContent)\n}\n\nexport function coerceToFileContent(value: unknown): value is FileContent {\n if (!value || typeof value !== 'object') {\n return false\n }\n\n const file = value as Record<string, unknown>\n if (typeof file.name !== 'string') {\n return false\n }\n\n switch (typeof file.blob) {\n case 'string': {\n const match = file.blob.match(/^data:(?<mimeType>[a-zA-Z0-9/]*);base64,(?<content>.*)$/)\n if (match?.groups === undefined) {\n return false\n }\n const { mimeType, content } = match.groups\n file.blob = new Blob([decode(content)], { type: mimeType })\n return true\n }\n case 'object':\n return file.blob instanceof Blob\n default:\n return false\n }\n}\n"],"names":["decode","findFiles","file","files","Array","isArray","filter","coerceToFileContent","value","name","blob","match","groups","undefined","mimeType","content","Blob","type"],"mappings":"AACA,SAASA,MAAM,QAAQ,cAAa;AAEpC,OAAO,SAASC,UAAUC,IAAa,EAAiB;IACtD,IAAI,CAACA,MAAM;QACT,OAAO,EAAE;IACX,CAAC;IAED,MAAMC,QAAmBC,MAAMC,OAAO,CAACH,QAAQA,OAAO;QAACA;KAAK;IAC5D,OAAOC,MAAMG,MAAM,CAACC;AACtB,CAAC;AAED,OAAO,SAASA,oBAAoBC,KAAc,EAAwB;IACxE,IAAI,CAACA,SAAS,OAAOA,UAAU,UAAU;QACvC,OAAO,KAAK;IACd,CAAC;IAED,MAAMN,OAAOM;IACb,IAAI,OAAON,KAAKO,IAAI,KAAK,UAAU;QACjC,OAAO,KAAK;IACd,CAAC;IAED,OAAQ,OAAOP,KAAKQ,IAAI;QACtB,KAAK;YAAU;gBACb,MAAMC,QAAQT,KAAKQ,IAAI,CAACC,KAAK,CAAC;gBAC9B,IAAIA,OAAOC,WAAWC,WAAW;oBAC/B,OAAO,KAAK;gBACd,CAAC;gBACD,MAAM,EAAEC,SAAQ,EAAEC,QAAO,EAAE,GAAGJ,MAAMC,MAAM;gBAC1CV,KAAKQ,IAAI,GAAG,IAAIM,KAAK;oBAAChB,OAAOe;iBAAS,EAAE;oBAAEE,MAAMH;gBAAS;gBACzD,OAAO,IAAI;YACb;QACA,KAAK;YACH,OAAOZ,KAAKQ,IAAI,YAAYM;QAC9B;YACE,OAAO,KAAK;IAChB;AACF,CAAC"}
|