@noya-app/noya-utils
Advanced tools
Comparing version 0.0.11 to 0.0.12
# @noya-app/noya-utils | ||
## 0.0.12 | ||
### Patch Changes | ||
- Bump versions | ||
## 0.0.11 | ||
@@ -4,0 +10,0 @@ |
@@ -156,2 +156,3 @@ declare function isShallowEqual<T>(a: T, b: T): boolean; | ||
readonly "application/zip": "zip"; | ||
readonly "application/x-7z-compressed": "7z"; | ||
}; | ||
@@ -165,2 +166,3 @@ declare const FILE_EXTENSION_TO_TYPE: Invert<{ | ||
readonly "application/zip": "zip"; | ||
readonly "application/x-7z-compressed": "7z"; | ||
}>; | ||
@@ -167,0 +169,0 @@ type FileTypeMap = typeof FILE_TYPE_TO_EXTENSION; |
@@ -453,3 +453,4 @@ "use strict"; | ||
"application/pdf": "pdf", | ||
"application/zip": "zip" | ||
"application/zip": "zip", | ||
"application/x-7z-compressed": "7z" | ||
}; | ||
@@ -482,2 +483,8 @@ var FILE_EXTENSION_TO_TYPE = invert(FILE_TYPE_TO_EXTENSION); | ||
} | ||
function isZip(bytes) { | ||
return startsWith(bytes, [80, 75]); | ||
} | ||
function is7z(bytes) { | ||
return startsWith(bytes, [55, 122, 188, 175, 39, 28]); | ||
} | ||
function detectFileType(arrayBuffer) { | ||
@@ -493,2 +500,6 @@ let bytes = new Uint8Array(arrayBuffer); | ||
return "application/pdf"; | ||
} else if (isZip(bytes)) { | ||
return "application/zip"; | ||
} else if (is7z(bytes)) { | ||
return "application/x-7z-compressed"; | ||
} | ||
@@ -565,3 +576,2 @@ } | ||
// src/debounce.ts | ||
var root = typeof window !== "undefined" ? window : global; | ||
function isObject(value) { | ||
@@ -572,2 +582,3 @@ const type = typeof value; | ||
function debounce(func, wait, options = {}) { | ||
const root = typeof window !== "undefined" ? window : global; | ||
let lastArgs, lastThis, maxWait, result, timerId, lastCallTime; | ||
@@ -574,0 +585,0 @@ let lastInvokeTime = 0; |
{ | ||
"name": "@noya-app/noya-utils", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.mjs", |
@@ -7,4 +7,2 @@ /* eslint-disable */ | ||
const root = typeof window !== 'undefined' ? window : global; | ||
function isObject(value: unknown) { | ||
@@ -86,2 +84,4 @@ const type = typeof value; | ||
} { | ||
const root = typeof window !== 'undefined' ? window : global; | ||
let lastArgs, lastThis, maxWait, result, timerId, lastCallTime; | ||
@@ -88,0 +88,0 @@ |
@@ -11,2 +11,3 @@ import { isEqualArray } from "./internal/isEqual"; | ||
"application/zip": "zip", | ||
"application/x-7z-compressed": "7z", | ||
} as const; | ||
@@ -58,2 +59,10 @@ | ||
function isZip(bytes: Uint8Array) { | ||
return startsWith(bytes, [0x50, 0x4b]); | ||
} | ||
function is7z(bytes: Uint8Array) { | ||
return startsWith(bytes, [0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c]); | ||
} | ||
export function detectFileType( | ||
@@ -72,3 +81,7 @@ arrayBuffer: ArrayLike<number> | ArrayBufferLike | ||
return "application/pdf"; | ||
} else if (isZip(bytes)) { | ||
return "application/zip"; | ||
} else if (is7z(bytes)) { | ||
return "application/x-7z-compressed"; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
210717
3376