🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@uppy/utils

Package Overview
Dependencies
Maintainers
8
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/utils - npm Package Compare versions

Comparing version

to
4.0.4

8

lib/AbortController.js

@@ -9,2 +9,8 @@ "use strict";

exports.createAbortError = (message = 'Aborted') => new DOMException(message, 'AbortError');
exports.createAbortError = function (message) {
if (message === void 0) {
message = 'Aborted';
}
return new DOMException(message, 'AbortError');
};

4

lib/fetchWithNetworkError.js

@@ -9,4 +9,4 @@ "use strict";

module.exports = function fetchWithNetworkError(...options) {
return fetch(...options).catch(err => {
module.exports = function fetchWithNetworkError() {
return fetch(...arguments).catch(err => {
if (err.name === 'AbortError') {

@@ -13,0 +13,0 @@ throw err;

@@ -12,3 +12,7 @@ "use strict";

module.exports = function findDOMElement(element, context = document) {
module.exports = function findDOMElement(element, context) {
if (context === void 0) {
context = document;
}
if (typeof element === 'string') {

@@ -15,0 +19,0 @@ return context.querySelector(element);

@@ -22,7 +22,9 @@ "use strict";

module.exports = function getDroppedFiles(dataTransfer, {
logDropError = () => {}
} = {}) {
module.exports = function getDroppedFiles(dataTransfer, _temp) {
var _dataTransfer$items;
let {
logDropError = () => {}
} = _temp === void 0 ? {} : _temp;
// Get all files from all subdirs. Works (at least) in Chrome, Mozilla, and Safari

@@ -29,0 +31,0 @@ if ((_dataTransfer$items = dataTransfer.items) != null && _dataTransfer$items[0] && 'webkitGetAsEntry' in dataTransfer.items[0]) {

@@ -11,5 +11,6 @@ "use strict";

*/
module.exports = function getFilesAndDirectoriesFromDirectory(directoryReader, oldEntries, logDropError, {
onSuccess
}) {
module.exports = function getFilesAndDirectoriesFromDirectory(directoryReader, oldEntries, logDropError, _ref) {
let {
onSuccess
} = _ref;
directoryReader.readEntries(entries => {

@@ -16,0 +17,0 @@ const newEntries = [...oldEntries, ...entries]; // According to the FileSystem API spec, getFilesAndDirectoriesFromDirectory()

"use strict";
class NetworkError extends Error {
constructor(error, xhr = null) {
constructor(error, xhr) {
if (xhr === void 0) {
xhr = null;
}
super(`This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.`);

@@ -6,0 +10,0 @@ this.cause = error;

@@ -69,6 +69,12 @@ "use strict";

wrapPromiseFunction(fn, queueOptions) {
return (...args) => {
var _this = this;
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
let queuedRequest;
const outerPromise = new Promise((resolve, reject) => {
queuedRequest = this.run(() => {
queuedRequest = _this.run(() => {
let cancelError;

@@ -172,3 +178,7 @@ let innerPromise;

function _queue2(fn, options = {}) {
function _queue2(fn, options) {
if (options === void 0) {
options = {};
}
const handler = {

@@ -175,0 +185,0 @@ fn,

{
"name": "@uppy/utils",
"description": "Shared utility functions for Uppy Core and plugins maintained by the Uppy team.",
"version": "4.0.3",
"version": "4.0.4",
"license": "MIT",

@@ -22,4 +22,3 @@ "main": "lib/index.js",

"lodash.throttle": "^4.1.1"
},
"gitHead": "b8b4127bd55b8e7395889048407c074fce944295"
}
}
}

@@ -25,3 +25,3 @@ const delay = require('./delay')

const start = Date.now()
const testDelay = delay(100, { signal: controller.signal })
const testDelay = delay(1000, { signal: controller.signal })
await Promise.all([

@@ -35,4 +35,4 @@ delay(50).then(() => controller.abort()),

expect(time).toBeGreaterThanOrEqual(30)
expect(time).toBeLessThan(70)
expect(time).toBeLessThan(900)
})
})

@@ -15,3 +15,3 @@ const generateFileID = require('./generateFileID')

expect(generateFileID(fileObj)).toEqual(
'uppy-foo0fi////jpg-20-53-14-1e-image/jpeg-2271173-1498510508000'
'uppy-foo0fi////jpg-20-53-14-1e-image/jpeg-2271173-1498510508000',
)

@@ -27,3 +27,3 @@

})).toEqual(
'uppy-/////////p/////////jpg-11k-11m-123-11s-11r-11g-1d-11k-11m-123-11s-11r-11g-122-11l-121-122-1e-image/jpeg-2271173-1498510508000'
'uppy-/////////p/////////jpg-11k-11m-123-11s-11r-11g-1d-11k-11m-123-11s-11r-11g-122-11l-121-122-1e-image/jpeg-2271173-1498510508000',
)

@@ -42,5 +42,5 @@

})).toEqual(
'uppy-hello/jpg-1e-image/jpeg-folder/a-1f-2271173-1498510508000'
'uppy-hello/jpg-1e-image/jpeg-folder/a-1f-2271173-1498510508000',
)
})
})

@@ -31,3 +31,3 @@ const toArray = require('../../../toArray')

resolve()
}
},
)

@@ -39,3 +39,3 @@ // This is a recursive call

onSuccess: (entries) => resolve(Promise.all(
entries.map(createPromiseToAddFileOrParseDirectory)
entries.map(createPromiseToAddFileOrParseDirectory),
)),

@@ -42,0 +42,0 @@ })

@@ -6,17 +6,17 @@ const getSocketHost = require('./getSocketHost')

expect(
getSocketHost('https://foo.bar/a/b/cd?e=fghi&l=k&m=n')
getSocketHost('https://foo.bar/a/b/cd?e=fghi&l=k&m=n'),
).toEqual('wss://foo.bar/a/b/cd?e=fghi&l=k&m=n')
expect(
getSocketHost('Https://foo.bar/a/b/cd?e=fghi&l=k&m=n')
getSocketHost('Https://foo.bar/a/b/cd?e=fghi&l=k&m=n'),
).toEqual('wss://foo.bar/a/b/cd?e=fghi&l=k&m=n')
expect(
getSocketHost('foo.bar/a/b/cd?e=fghi&l=k&m=n')
getSocketHost('foo.bar/a/b/cd?e=fghi&l=k&m=n'),
).toEqual('wss://foo.bar/a/b/cd?e=fghi&l=k&m=n')
expect(
getSocketHost('http://foo.bar/a/b/cd?e=fghi&l=k&m=n')
getSocketHost('http://foo.bar/a/b/cd?e=fghi&l=k&m=n'),
).toEqual('ws://foo.bar/a/b/cd?e=fghi&l=k&m=n')
})
})

@@ -8,9 +8,9 @@ /**

class ProgressTimeout {
#aliveTimer;
#aliveTimer
#isDone = false;
#isDone = false
#onTimedOut;
#onTimedOut
#timeout;
#timeout

@@ -17,0 +17,0 @@ constructor (timeout, timeoutHandler) {

@@ -12,3 +12,3 @@ module.exports = function settle (promises) {

const wait = Promise.all(
promises.map((promise) => promise.then(resolved, rejected))
promises.map((promise) => promise.then(resolved, rejected)),
)

@@ -15,0 +15,0 @@

@@ -9,3 +9,3 @@ const settle = require('./settle')

Promise.reject(new Error('this went wrong')),
])
]),
).resolves.toMatchObject({

@@ -23,3 +23,3 @@ successful: [],

Promise.resolve('also-resolved'),
])
]),
).resolves.toMatchObject({

@@ -26,0 +26,0 @@ successful: ['resolved', 'also-resolved'],

@@ -81,3 +81,3 @@ const Translator = require('./Translator')

expect(
translator.translate('youHaveChosen', { fileName: 'img.jpg' })
translator.translate('youHaveChosen', { fileName: 'img.jpg' }),
).toEqual('You have chosen: img.jpg')

@@ -89,3 +89,3 @@ })

expect(
translator.translate('youHaveChosen', { fileName: 'img.jpg' })
translator.translate('youHaveChosen', { fileName: 'img.jpg' }),
).toEqual('Beep boop: img.jpg')

@@ -99,3 +99,3 @@ })

expect(
translator.translate('youHaveChosen', { fileName: 'img.jpg' })
translator.translate('youHaveChosen', { fileName: 'img.jpg' }),
).toEqual('You have chosen: img.jpg')

@@ -109,11 +109,11 @@ })

expect(
translator.translate('filesChosen', { smart_count: 18 })
translator.translate('filesChosen', { smart_count: 18 }),
).toEqual('Выбрано 18 файлов')
expect(
translator.translate('filesChosen', { smart_count: 1 })
translator.translate('filesChosen', { smart_count: 1 }),
).toEqual('Выбран 1 файл')
expect(
translator.translate('filesChosen', { smart_count: 0 })
translator.translate('filesChosen', { smart_count: 0 }),
).toEqual('Выбрано 0 файлов')

@@ -131,9 +131,9 @@ })

expect(
translator.translate('theAmount', { smart_count: 0 })
translator.translate('theAmount', { smart_count: 0 }),
).toEqual('het aantal is 0')
expect(
translator.translate('theAmount', { smart_count: 1 })
translator.translate('theAmount', { smart_count: 1 }),
).toEqual('het aantal is 1')
expect(
translator.translate('theAmount', { smart_count: 1202530 })
translator.translate('theAmount', { smart_count: 1202530 }),
).toEqual('het aantal is 1202530')

@@ -140,0 +140,0 @@ })

@@ -165,3 +165,3 @@ declare module '@uppy/utils/lib/Translator' {

function getFileType (file: UppyUtils.UppyFile): string | null
function getFileType (file: UppyUtils.UppyFile): string
export = getFileType

@@ -168,0 +168,0 @@ }

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

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