@uppy/utils
Advanced tools
Comparing version 2.2.1 to 2.2.2
{ | ||
"name": "@uppy/utils", | ||
"description": "Shared utility functions for Uppy Core and plugins maintained by the Uppy team.", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"license": "MIT", | ||
@@ -23,3 +23,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "07e9909bfcca44505433c8bfc38a050314be64ce" | ||
"gitHead": "2c98271103539fbe46b37b9f8c2746bc7188b9c8" | ||
} |
@@ -6,6 +6,6 @@ declare module '@uppy/utils/lib/Translator' { | ||
strings: { | ||
[key: string]: string | { [plural: number]: string }; | ||
}; | ||
pluralize: (n: number) => number; | ||
}; | ||
[key: string]: string | { [plural: number]: string } | ||
} | ||
pluralize: (n: number) => number | ||
} | ||
} | ||
@@ -15,3 +15,3 @@ } | ||
class Translator { | ||
constructor(opts: Translator.TranslatorOptions); | ||
constructor (opts: Translator.TranslatorOptions) | ||
} | ||
@@ -24,6 +24,6 @@ | ||
namespace EventTracker { | ||
export type EventHandler = (...args: any[]) => void; | ||
export type EventHandler = (...args: any[]) => void | ||
export interface Emitter { | ||
on: (event: string, handler: EventHandler) => void; | ||
off: (event: string, handler: EventHandler) => void; | ||
on: (event: string, handler: EventHandler) => void | ||
off: (event: string, handler: EventHandler) => void | ||
} | ||
@@ -33,5 +33,5 @@ } | ||
class EventTracker { | ||
constructor(emitter: EventTracker.Emitter); | ||
on(event: string, handler: EventTracker.EventHandler): void; | ||
remove(): void; | ||
constructor (emitter: EventTracker.Emitter) | ||
on (event: string, handler: EventTracker.EventHandler): void | ||
remove (): void | ||
} | ||
@@ -44,5 +44,5 @@ | ||
class ProgressTimeout { | ||
constructor(timeout: number, timeoutHandler: () => void); | ||
progress(): void; | ||
done(): void; | ||
constructor (timeout: number, timeoutHandler: () => void) | ||
progress (): void | ||
done (): void | ||
} | ||
@@ -54,14 +54,16 @@ export = ProgressTimeout | ||
namespace RateLimitedQueue { | ||
export type AbortFunction = () => void; | ||
export type PromiseFunction = (...args: any[]) => Promise<any>; | ||
export type AbortFunction = () => void | ||
export type PromiseFunction = (...args: any[]) => Promise<any> | ||
export type QueueEntry = { | ||
abort: () => void, | ||
done: () => void, | ||
}; | ||
abort: () => void | ||
done: () => void | ||
} | ||
} | ||
class RateLimitedQueue { | ||
constructor(limit: number); | ||
run(fn: () => RateLimitedQueue.AbortFunction): RateLimitedQueue.QueueEntry; | ||
wrapPromiseFunction(fn: () => RateLimitedQueue.PromiseFunction): RateLimitedQueue.PromiseFunction; | ||
constructor (limit: number) | ||
run (fn: () => RateLimitedQueue.AbortFunction): RateLimitedQueue.QueueEntry | ||
wrapPromiseFunction( | ||
fn: () => RateLimitedQueue.PromiseFunction | ||
): RateLimitedQueue.PromiseFunction | ||
} | ||
@@ -73,3 +75,7 @@ | ||
declare module '@uppy/utils/lib/canvasToBlob' { | ||
function canvasToBlob(canvas: HTMLCanvasElement, type: string, quality?: number): Promise<Blob>; | ||
function canvasToBlob ( | ||
canvas: HTMLCanvasElement, | ||
type: string, | ||
quality?: number | ||
): Promise<Blob> | ||
export = canvasToBlob | ||
@@ -79,3 +85,6 @@ } | ||
declare module '@uppy/utils/lib/dataURItoBlob' { | ||
function dataURItoBlob(dataURI: string, opts: { mimeType?: string, name?: string }): Blob; | ||
function dataURItoBlob ( | ||
dataURI: string, | ||
opts: { mimeType?: string; name?: string } | ||
): Blob | ||
export = dataURItoBlob | ||
@@ -85,3 +94,6 @@ } | ||
declare module '@uppy/utils/lib/dataURItoFile' { | ||
function dataURItoFile(dataURI: string, opts: { mimeType?: string, name?: string }): File; | ||
function dataURItoFile ( | ||
dataURI: string, | ||
opts: { mimeType?: string; name?: string } | ||
): File | ||
export = dataURItoFile | ||
@@ -91,11 +103,15 @@ } | ||
declare module '@uppy/utils/lib/emitSocketProgress' { | ||
import UppyUtils = require('@uppy/utils'); | ||
import UppyUtils = require('@uppy/utils') | ||
interface ProgressData { | ||
progress: number; | ||
bytesUploaded: number; | ||
bytesTotal: number; | ||
progress: number | ||
bytesUploaded: number | ||
bytesTotal: number | ||
} | ||
function emitSocketProgress(uploader: object, progressData: ProgressData, file: UppyUtils.UppyFile): void; | ||
function emitSocketProgress ( | ||
uploader: object, | ||
progressData: ProgressData, | ||
file: UppyUtils.UppyFile | ||
): void | ||
export = emitSocketProgress | ||
@@ -105,3 +121,3 @@ } | ||
declare module '@uppy/utils/lib/findAllDOMElements' { | ||
function findAllDOMElements(element: string | HTMLElement): HTMLElement[]; | ||
function findAllDOMElements (element: string | HTMLElement): HTMLElement[] | ||
export = findAllDOMElements | ||
@@ -111,3 +127,3 @@ } | ||
declare module '@uppy/utils/lib/findDOMElement' { | ||
function findDOMElement(element: string | HTMLElement): HTMLElement | null; | ||
function findDOMElement (element: string | HTMLElement): HTMLElement | null | ||
export = findDOMElement | ||
@@ -117,5 +133,5 @@ } | ||
declare module '@uppy/utils/lib/generateFileID' { | ||
import UppyUtils = require('@uppy/utils'); | ||
import UppyUtils = require('@uppy/utils') | ||
function generateFileID(file: UppyUtils.UppyFile): string; | ||
function generateFileID (file: UppyUtils.UppyFile): string | ||
export = generateFileID | ||
@@ -125,3 +141,6 @@ } | ||
declare module '@uppy/utils/lib/getBytesRemaining' { | ||
function getBytesRemaining(progress: { bytesTotal: number, bytesUploaded: number }): number; | ||
function getBytesRemaining (progress: { | ||
bytesTotal: number | ||
bytesUploaded: number | ||
}): number | ||
export = getBytesRemaining | ||
@@ -131,3 +150,3 @@ } | ||
declare module '@uppy/utils/lib/getETA' { | ||
function getETA(progress: object): number; | ||
function getETA (progress: object): number | ||
export = getETA | ||
@@ -137,3 +156,5 @@ } | ||
declare module '@uppy/utils/lib/getFileNameAndExtension' { | ||
function getFileNameAndExtension(filename: string): { name: string, extension: string | undefined }; | ||
function getFileNameAndExtension( | ||
filename: string | ||
): { name: string, extension: string | undefined }; | ||
export = getFileNameAndExtension | ||
@@ -143,5 +164,5 @@ } | ||
declare module '@uppy/utils/lib/getFileType' { | ||
import UppyUtils = require('@uppy/utils'); | ||
import UppyUtils = require('@uppy/utils') | ||
function getFileType(file: UppyUtils.UppyFile): string | null; | ||
function getFileType (file: UppyUtils.UppyFile): string | null | ||
export = getFileType | ||
@@ -151,3 +172,3 @@ } | ||
declare module '@uppy/utils/lib/getFileTypeExtension' { | ||
function getFileTypeExtension(mime: string): string; | ||
function getFileTypeExtension (mime: string): string | ||
export = getFileTypeExtension | ||
@@ -157,3 +178,3 @@ } | ||
declare module '@uppy/utils/lib/getSocketHost' { | ||
function getSocketHost(url: string): string; | ||
function getSocketHost (url: string): string | ||
export = getSocketHost | ||
@@ -163,3 +184,6 @@ } | ||
declare module '@uppy/utils/lib/getSpeed' { | ||
function getSpeed(progress: { bytesTotal: number, bytesUploaded: number }): number; | ||
function getSpeed (progress: { | ||
bytesTotal: number | ||
bytesUploaded: number | ||
}): number | ||
export = getSpeed | ||
@@ -169,3 +193,3 @@ } | ||
declare module '@uppy/utils/lib/getTimeStamp' { | ||
function getTimeStamp(): string; | ||
function getTimeStamp (): string | ||
export = getTimeStamp | ||
@@ -175,3 +199,3 @@ } | ||
declare module '@uppy/utils/lib/isDOMElement' { | ||
function isDOMElement(element: any): boolean; | ||
function isDOMElement (element: any): boolean | ||
export = isDOMElement | ||
@@ -181,3 +205,3 @@ } | ||
declare module '@uppy/utils/lib/isObjectURL' { | ||
function isObjectURL(url: string): boolean; | ||
function isObjectURL (url: string): boolean | ||
export = isObjectURL | ||
@@ -187,3 +211,3 @@ } | ||
declare module '@uppy/utils/lib/isDragDropSupported' { | ||
function isDragDropSupported(): boolean; | ||
function isDragDropSupported (): boolean | ||
export = isDragDropSupported | ||
@@ -193,3 +217,3 @@ } | ||
declare module '@uppy/utils/lib/isPreviewSupported' { | ||
function isPreviewSupported(mime: string): boolean; | ||
function isPreviewSupported (mime: string): boolean | ||
export = isPreviewSupported | ||
@@ -199,3 +223,3 @@ } | ||
declare module '@uppy/utils/lib/isTouchDevice' { | ||
function isTouchDevice(): boolean; | ||
function isTouchDevice (): boolean | ||
export = isTouchDevice | ||
@@ -205,3 +229,3 @@ } | ||
declare module '@uppy/utils/lib/prettyETA' { | ||
function prettyETA(seconds: number): string; | ||
function prettyETA (seconds: number): string | ||
export = prettyETA | ||
@@ -211,3 +235,3 @@ } | ||
declare module '@uppy/utils/lib/secondsToTime' { | ||
function secondsToTime(seconds: number): string; | ||
function secondsToTime (seconds: number): string | ||
export = secondsToTime | ||
@@ -217,3 +241,5 @@ } | ||
declare module '@uppy/utils/lib/settle' { | ||
function settle<T>(promises: Promise<T>[]): Promise<{ successful: T[], failed: any[] }>; | ||
function settle<T> ( | ||
promises: Promise<T>[] | ||
): Promise<{ successful: T[]; failed: any[] }> | ||
export = settle | ||
@@ -223,3 +249,3 @@ } | ||
declare module '@uppy/utils/lib/toArray' { | ||
function toArray(list: any): any[]; | ||
function toArray (list: any): any[] | ||
export = toArray | ||
@@ -229,3 +255,6 @@ } | ||
declare module '@uppy/utils/lib/getDroppedFiles' { | ||
function getDroppedFiles(dataTransfer: DataTransfer, options?: object): Promise<File[]>; | ||
function getDroppedFiles ( | ||
dataTransfer: DataTransfer, | ||
options?: object | ||
): Promise<File[]> | ||
export = getDroppedFiles | ||
@@ -236,41 +265,44 @@ } | ||
interface IndexedObject<T> { | ||
[key: string]: T; | ||
[key: number]: T; | ||
[key: string]: T | ||
[key: number]: T | ||
} | ||
export type InternalMetadata = { name: string, type?: string }; | ||
export interface UppyFile<TMeta = IndexedObject<any>, TBody = IndexedObject<any>> { | ||
data: Blob | File; | ||
extension: string; | ||
id: string; | ||
isPaused?: boolean; | ||
isRemote: boolean; | ||
meta: InternalMetadata & TMeta; | ||
name: string; | ||
preview?: string; | ||
export type InternalMetadata = { name: string; type?: string } | ||
export interface UppyFile< | ||
TMeta = IndexedObject<any>, | ||
TBody = IndexedObject<any> | ||
> { | ||
data: Blob | File | ||
extension: string | ||
id: string | ||
isPaused?: boolean | ||
isRemote: boolean | ||
meta: InternalMetadata & TMeta | ||
name: string | ||
preview?: string | ||
progress?: { | ||
uploadStarted: number | null; | ||
uploadComplete: boolean; | ||
percentage: number; | ||
bytesUploaded: number; | ||
bytesTotal: number; | ||
}; | ||
uploadStarted: number | null | ||
uploadComplete: boolean | ||
percentage: number | ||
bytesUploaded: number | ||
bytesTotal: number | ||
} | ||
remote?: { | ||
host: string; | ||
url: string; | ||
body?: object; | ||
}; | ||
size: number; | ||
source?: string; | ||
type?: string; | ||
host: string | ||
url: string | ||
body?: object | ||
} | ||
size: number | ||
source?: string | ||
type?: string | ||
response?: { | ||
body: TBody; | ||
status: number; | ||
uploadURL: string | undefined; | ||
}; | ||
body: TBody | ||
status: number | ||
uploadURL: string | undefined | ||
} | ||
} | ||
export interface Store { | ||
getState(): object; | ||
setState(patch: object): void; | ||
subscribe(listener: any): () => void; | ||
getState (): object | ||
setState (patch: object): void | ||
subscribe (listener: any): () => void | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119209
144
2418