Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@naturalcycles/js-lib

Package Overview
Dependencies
Maintainers
2
Versions
525
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/js-lib - npm Package Compare versions

Comparing version 14.235.0 to 14.236.0

11

dist-esm/array/range.js

@@ -1,2 +0,1 @@

import { __asyncGenerator, __await } from "tslib";
import { AsyncIterable2 } from '../iter/asyncIterable2';

@@ -29,10 +28,8 @@ import { Iterable2 } from '../iter/iterable2';

return AsyncIterable2.of({
[Symbol.asyncIterator]() {
return __asyncGenerator(this, arguments, function* _a() {
for (let i = fromIncl; i < toExcl; i += step) {
yield yield __await(i);
}
});
async *[Symbol.asyncIterator]() {
for (let i = fromIncl; i < toExcl; i += step) {
yield i;
}
},
});
}

@@ -115,7 +115,6 @@ import { _assert } from '../error/assert';

setComponents(c, mutate = false) {
var _a;
const d = mutate ? this.$date : new Date(this.$date);
// Year, month and day set all-at-once, to avoid 30/31 (and 28/29) mishap
if (c.day || c.month !== undefined || c.year !== undefined) {
d.setFullYear((_a = c.year) !== null && _a !== void 0 ? _a : d.getFullYear(), c.month ? c.month - 1 : d.getMonth(), c.day || d.getDate());
d.setFullYear(c.year ?? d.getFullYear(), c.month ? c.month - 1 : d.getMonth(), c.day || d.getDate());
}

@@ -321,3 +320,3 @@ if (c.hour !== undefined) {

isOlderThan(n, unit, now) {
return this.isBefore(localTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
return this.isBefore(localTime.of(now ?? new Date()).plus(-n, unit));
}

@@ -328,3 +327,3 @@ /**

isSameOrOlderThan(n, unit, now) {
return this.isSameOrBefore(localTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
return this.isSameOrBefore(localTime.of(now ?? new Date()).plus(-n, unit));
}

@@ -341,3 +340,3 @@ /**

isYoungerThan(n, unit, now) {
return this.isAfter(localTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
return this.isAfter(localTime.of(now ?? new Date()).plus(-n, unit));
}

@@ -348,3 +347,3 @@ /**

isSameOrYoungerThan(n, unit, now) {
return this.isSameOrAfter(localTime.of(now !== null && now !== void 0 ? now : new Date()).plus(-n, unit));
return this.isSameOrAfter(localTime.of(now ?? new Date()).plus(-n, unit));
}

@@ -364,3 +363,6 @@ /**

components() {
return Object.assign(Object.assign({}, this.dateComponents()), this.timeComponents());
return {
...this.dateComponents(),
...this.timeComponents(),
};
}

@@ -367,0 +369,0 @@ dateComponents() {

@@ -111,4 +111,4 @@ import { _assert } from '../error/assert';

export function _getAsyncMemo(method) {
_assert(typeof (method === null || method === void 0 ? void 0 : method.getInstanceCache) === 'function', 'method is not an AsyncMemo instance');
_assert(typeof method?.getInstanceCache === 'function', 'method is not an AsyncMemo instance');
return method;
}

@@ -21,3 +21,2 @@ import { _getTargetMethodSignature } from './decorator.util';

pd.value = async function (...args) {
var _a, _b;
// console.log(`@${cfg.decoratorName} called inside function`)

@@ -50,5 +49,8 @@ const started = Date.now();

if (cfg.thenFn) {
res = cfg.thenFn(Object.assign(Object.assign({}, resp), { res }));
res = cfg.thenFn({
...resp,
res,
});
}
(_a = cfg.finallyFn) === null || _a === void 0 ? void 0 : _a.call(cfg, resp);
cfg.finallyFn?.(resp);
return res;

@@ -68,6 +70,9 @@ }

if (cfg.catchFn) {
cfg.catchFn(Object.assign(Object.assign({}, resp), { err }));
cfg.catchFn({
...resp,
err,
});
handled = true;
}
(_b = cfg.finallyFn) === null || _b === void 0 ? void 0 : _b.call(cfg, resp);
cfg.finallyFn?.(resp);
if (!handled) {

@@ -74,0 +79,0 @@ throw err; // rethrow

@@ -108,3 +108,8 @@ export function _debounce(func, wait, opt = {}) {

export function _throttle(func, wait, opt = {}) {
return _debounce(func, wait, Object.assign(Object.assign({ leading: true, trailing: true }, opt), { maxWait: wait }));
return _debounce(func, wait, {
leading: true,
trailing: true,
...opt,
maxWait: wait,
});
}

@@ -80,4 +80,4 @@ import { _assert } from '../error/assert';

export function _getMemo(method) {
_assert(typeof (method === null || method === void 0 ? void 0 : method.getInstanceCache) === 'function', 'method is not a Memo instance');
_assert(typeof method?.getInstanceCache === 'function', 'method is not a Memo instance');
return method;
}

@@ -79,3 +79,9 @@ import { _mapObject, _mapValues } from './object/object.util';

export function _defineProperty(obj, prop, pd) {
return Object.defineProperty(obj, prop, Object.assign({ writable: true, configurable: true, enumerable: true }, pd));
return Object.defineProperty(obj, prop, {
writable: true,
configurable: true,
enumerable: true,
// value: obj[prop], // existing value is already kept by default
...pd,
});
}

@@ -87,3 +93,9 @@ /**

export function _defineProps(obj, props) {
return Object.defineProperties(obj, _mapValues(props, (k, pd) => (Object.assign({ writable: true, configurable: true, enumerable: true }, pd))));
return Object.defineProperties(obj, _mapValues(props, (k, pd) => ({
writable: true,
configurable: true,
enumerable: true,
// value: obj[k], // existing value is already kept by default
...pd,
})));
}

@@ -90,0 +102,0 @@ /**

@@ -150,4 +150,3 @@ /**

v) {
var _a;
return (_a = Object.entries(en).find(([_, v2]) => v2 === v)) === null || _a === void 0 ? void 0 : _a[0];
return Object.entries(en).find(([_, v2]) => v2 === v)?.[0];
}

@@ -154,0 +153,0 @@ export function _stringEnumKey(en, v) {

@@ -20,3 +20,6 @@ import { _deepEquals, _isErrorObject, _stringify, AssertionError } from '..';

if (!condition) {
throw new AssertionError(message || 'condition failed', Object.assign({ userFriendly: true }, errorData));
throw new AssertionError(message || 'condition failed', {
userFriendly: true,
...errorData,
});
}

@@ -36,3 +39,6 @@ }

.join('\n');
throw new AssertionError(msg, Object.assign({ userFriendly: true }, errorData));
throw new AssertionError(msg, {
userFriendly: true,
...errorData,
});
}

@@ -52,3 +58,6 @@ }

.join('\n');
throw new AssertionError(msg, Object.assign({ userFriendly: true }, errorData));
throw new AssertionError(msg, {
userFriendly: true,
...errorData,
});
}

@@ -55,0 +64,0 @@ }

@@ -22,3 +22,6 @@ import { _jsonParseIfPossible, _stringify, _truncate, _truncateMiddle, isServerSide } from '..';

;
e.data = Object.assign(Object.assign({}, e.data), errorData);
e.data = {
...e.data,
...errorData,
};
}

@@ -77,3 +80,3 @@ return e;

message: e.message,
data: Object.assign({}, e.data), // empty by default
data: { ...e.data }, // empty by default
};

@@ -173,7 +176,6 @@ if (e.stack)

export function _isBackendErrorResponseObject(o) {
return _isErrorObject(o === null || o === void 0 ? void 0 : o.error);
return _isErrorObject(o?.error);
}
export function _isHttpRequestErrorObject(o) {
var _a;
return !!o && o.name === 'HttpRequestError' && typeof ((_a = o.data) === null || _a === void 0 ? void 0 : _a.requestUrl) === 'string';
return !!o && o.name === 'HttpRequestError' && typeof o.data?.requestUrl === 'string';
}

@@ -210,3 +212,6 @@ /**

return err;
err.data = Object.assign(Object.assign({}, err.data), data);
err.data = {
...err.data,
...data,
};
return err;

@@ -301,3 +306,3 @@ }

}
super(message, data, Object.assign(Object.assign({}, opt), { name: 'HttpRequestError' }));
super(message, data, { ...opt, name: 'HttpRequestError' });
}

@@ -320,3 +325,3 @@ }

constructor(message, data, opt) {
super(message, data, Object.assign(Object.assign({}, opt), { name: 'TimeoutError' }));
super(message, data, { ...opt, name: 'TimeoutError' });
}

@@ -323,0 +328,0 @@ }

@@ -30,3 +30,3 @@ import { _anyToError, _since } from '../index';

}
catch (_a) { }
catch { }
}

@@ -33,0 +33,0 @@ // returns undefined, but doesn't rethrow

@@ -44,4 +44,8 @@ /// <reference lib="es2022"/>

this[`${m}Void`] = async (url, opt) => {
return await this.fetch(Object.assign({ url,
method, responseType: 'void' }, opt));
return await this.fetch({
url,
method,
responseType: 'void',
...opt,
});
};

@@ -52,8 +56,16 @@ if (method === 'HEAD')

this[`${m}Text`] = async (url, opt) => {
return await this.fetch(Object.assign({ url,
method, responseType: 'text' }, opt));
return await this.fetch({
url,
method,
responseType: 'text',
...opt,
});
};
this[m] = async (url, opt) => {
return await this.fetch(Object.assign({ url,
method, responseType: 'json' }, opt));
return await this.fetch({
url,
method,
responseType: 'json',
...opt,
});
};

@@ -94,3 +106,7 @@ }

async getReadableStream(url, opt) {
return await this.fetch(Object.assign({ url, responseType: 'readableStream' }, opt));
return await this.fetch({
url,
responseType: 'readableStream',
...opt,
});
}

@@ -141,3 +157,2 @@ async fetch(opt) {

async doFetch(opt) {
var _b, _c;
const req = this.normalizeOptions(opt);

@@ -208,4 +223,4 @@ const { logger } = this.cfg;

res.statusFamily = this.getStatusFamily(res);
res.statusCode = (_b = res.fetchResponse) === null || _b === void 0 ? void 0 : _b.status;
if (((_c = res.fetchResponse) === null || _c === void 0 ? void 0 : _c.ok) || !req.throwHttpErrors) {
res.statusCode = res.fetchResponse?.status;
if (res.fetchResponse?.ok || !req.throwHttpErrors) {
try {

@@ -304,3 +319,2 @@ // We are applying a separate Timeout (as long as original Timeout for now) to "download and parse the body"

async onNotOkResponse(res) {
var _b;
let cause;

@@ -324,3 +338,3 @@ if (res.err) {

});
let responseStatusCode = ((_b = res.fetchResponse) === null || _b === void 0 ? void 0 : _b.status) || 0;
let responseStatusCode = res.fetchResponse?.status || 0;
if (res.statusFamily === 2) {

@@ -352,3 +366,2 @@ // important to reset httpStatusCode to 0 in this case, as status 2xx can be misleading

async processRetry(res) {
var _b;
const { retryStatus } = res;

@@ -373,3 +386,3 @@ if (!this.shouldRetry(res)) {

' <<',
((_b = res.fetchResponse) === null || _b === void 0 ? void 0 : _b.status) || 0,
res.fetchResponse?.status || 0,
res.signature,

@@ -397,3 +410,2 @@ count &&

getRetryTimeout(res) {
var _b;
let timeout = 0;

@@ -403,3 +415,4 @@ // Handling http 429 with specific retry headers

if (res.fetchResponse && [429, 503].includes(res.fetchResponse.status)) {
const retryAfterStr = (_b = res.fetchResponse.headers.get('retry-after')) !== null && _b !== void 0 ? _b : res.fetchResponse.headers.get('x-ratelimit-reset');
const retryAfterStr = res.fetchResponse.headers.get('retry-after') ??
res.fetchResponse.headers.get('x-ratelimit-reset');
if (retryAfterStr) {

@@ -434,3 +447,2 @@ if (Number(retryAfterStr)) {

shouldRetry(res) {
var _b, _c, _d, _e, _f;
const { retryPost, retry3xx, retry4xx, retry5xx } = res.req;

@@ -441,3 +453,3 @@ const { method } = res.req.init;

const { statusFamily } = res;
const statusCode = ((_b = res.fetchResponse) === null || _b === void 0 ? void 0 : _b.status) || 0;
const statusCode = res.fetchResponse?.status || 0;
if (statusFamily === 5 && !retry5xx)

@@ -454,3 +466,3 @@ return false;

// should not retry on `unexpected redirect` in error.cause.cause
if ((_f = (_e = (_d = (_c = res.err) === null || _c === void 0 ? void 0 : _c.cause) === null || _d === void 0 ? void 0 : _d.cause) === null || _e === void 0 ? void 0 : _e.message) === null || _f === void 0 ? void 0 : _f.includes('unexpected redirect')) {
if (res.err?.cause?.cause?.message?.includes('unexpected redirect')) {
return false;

@@ -461,4 +473,3 @@ }

getStatusFamily(res) {
var _b;
const status = (_b = res.fetchResponse) === null || _b === void 0 ? void 0 : _b.status;
const status = res.fetchResponse?.status;
if (!status)

@@ -496,4 +507,3 @@ return;

normalizeCfg(cfg) {
var _b;
if ((_b = cfg.baseUrl) === null || _b === void 0 ? void 0 : _b.endsWith('/')) {
if (cfg.baseUrl?.endsWith('/')) {
console.warn(`Fetcher: baseUrl should not end with slash: ${cfg.baseUrl}`);

@@ -522,6 +532,9 @@ cfg.baseUrl = cfg.baseUrl.slice(0, cfg.baseUrl.length - 1);

logWithSearchParams: true,
retry: Object.assign({}, defRetryOptions),
retry: { ...defRetryOptions },
init: {
method: cfg.method || 'GET',
headers: _filterNullishValues(Object.assign({ 'user-agent': _a.userAgent }, cfg.headers)),
headers: _filterNullishValues({
'user-agent': _a.userAgent,
...cfg.headers,
}),
credentials: cfg.credentials,

@@ -538,18 +551,35 @@ redirect: cfg.redirect,

var _b;
const req = Object.assign(Object.assign(Object.assign(Object.assign({}, _pick(this.cfg, [
'timeoutSeconds',
'retryPost',
'retry4xx',
'retry5xx',
'responseType',
'jsonReviver',
'logRequest',
'logRequestBody',
'logResponse',
'logResponseBody',
'debug',
'throwHttpErrors',
])), { started: Date.now() }), _omit(opt, ['method', 'headers', 'credentials'])), { inputUrl: opt.url || '', fullUrl: opt.url || '', retry: Object.assign(Object.assign({}, this.cfg.retry), _filterUndefinedValues(opt.retry || {})), init: _merge(Object.assign(Object.assign({}, this.cfg.init), { headers: Object.assign({}, this.cfg.init.headers), method: opt.method || this.cfg.init.method, credentials: opt.credentials || this.cfg.init.credentials, redirect: opt.redirect || this.cfg.init.redirect || 'follow' }), {
const req = {
..._pick(this.cfg, [
'timeoutSeconds',
'retryPost',
'retry4xx',
'retry5xx',
'responseType',
'jsonReviver',
'logRequest',
'logRequestBody',
'logResponse',
'logResponseBody',
'debug',
'throwHttpErrors',
]),
started: Date.now(),
..._omit(opt, ['method', 'headers', 'credentials']),
inputUrl: opt.url || '',
fullUrl: opt.url || '',
retry: {
...this.cfg.retry,
..._filterUndefinedValues(opt.retry || {}),
},
init: _merge({
...this.cfg.init,
headers: { ...this.cfg.init.headers }, // this avoids mutation
method: opt.method || this.cfg.init.method,
credentials: opt.credentials || this.cfg.init.credentials,
redirect: opt.redirect || this.cfg.init.redirect || 'follow',
}, {
headers: _mapKeys(opt.headers || {}, k => k.toLowerCase()),
}) });
}),
};
// Because all header values are stringified, so `a: undefined` becomes `undefined` as a string

@@ -566,3 +596,6 @@ _filterNullishValues(req.init.headers, true);

}
const searchParams = _filterUndefinedValues(Object.assign(Object.assign({}, this.cfg.searchParams), opt.searchParams));
const searchParams = _filterUndefinedValues({
...this.cfg.searchParams,
...opt.searchParams,
});
if (Object.keys(searchParams).length) {

@@ -569,0 +602,0 @@ const qs = new URLSearchParams(searchParams).toString();

@@ -1,2 +0,1 @@

import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
import { END, SKIP } from '../types';

@@ -22,6 +21,4 @@ /**

return new AsyncIterable2({
[Symbol.asyncIterator]() {
return __asyncGenerator(this, arguments, function* _a() {
yield __await(yield* __asyncDelegator(__asyncValues(it)));
});
async *[Symbol.asyncIterator]() {
yield* it;
},

@@ -32,3 +29,3 @@ });

return new AsyncIterable2({
[Symbol.asyncIterator]() { return __asyncGenerator(this, arguments, function* _a() { }); },
async *[Symbol.asyncIterator]() { },
});

@@ -42,40 +39,14 @@ }

// return await Array.fromAsync(this.it)
var _a, e_1, _b, _c;
const res = [];
try {
for (var _d = true, _e = __asyncValues(this.it), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const item = _c;
res.push(item);
}
for await (const item of this.it) {
res.push(item);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
}
finally { if (e_1) throw e_1.error; }
}
return res;
}
async forEach(cb) {
var _a, e_2, _b, _c;
let i = 0;
try {
for (var _d = true, _e = __asyncValues(this.it), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const v = _c;
if ((await cb(v, i++)) === END)
return;
}
for await (const v of this.it) {
if ((await cb(v, i++)) === END)
return;
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
}

@@ -86,45 +57,19 @@ async some(cb) {

async every(cb) {
var _a, e_3, _b, _c;
let i = 0;
try {
for (var _d = true, _e = __asyncValues(this.it), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const v = _c;
const r = await cb(v, i++);
if (r === END || !r)
return false;
}
for await (const v of this.it) {
const r = await cb(v, i++);
if (r === END || !r)
return false;
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
}
finally { if (e_3) throw e_3.error; }
}
return true;
}
async find(cb) {
var _a, e_4, _b, _c;
let i = 0;
try {
for (var _d = true, _e = __asyncValues(this.it), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const v = _c;
const r = await cb(v, i++);
if (r === END)
return;
if (r)
return v;
}
for await (const v of this.it) {
const r = await cb(v, i++);
if (r === END)
return;
if (r)
return v;
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
}
finally { if (e_4) throw e_4.error; }
}
}

@@ -134,26 +79,11 @@ filter(cb) {

return new AsyncIterable2({
[Symbol.asyncIterator]() {
return __asyncGenerator(this, arguments, function* _a() {
var _b, e_5, _c, _d;
let i = 0;
try {
for (var _e = true, it_1 = __asyncValues(it), it_1_1; it_1_1 = yield __await(it_1.next()), _b = it_1_1.done, !_b; _e = true) {
_d = it_1_1.value;
_e = false;
const v = _d;
const r = yield __await(cb(v, i++));
if (r === END)
return yield __await(void 0);
if (r)
yield yield __await(v);
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (!_e && !_b && (_c = it_1.return)) yield __await(_c.call(it_1));
}
finally { if (e_5) throw e_5.error; }
}
});
async *[Symbol.asyncIterator]() {
let i = 0;
for await (const v of it) {
const r = await cb(v, i++);
if (r === END)
return;
if (r)
yield v;
}
},

@@ -165,27 +95,12 @@ });

return new AsyncIterable2({
[Symbol.asyncIterator]() {
return __asyncGenerator(this, arguments, function* _a() {
var _b, e_6, _c, _d;
let i = 0;
try {
for (var _e = true, it_2 = __asyncValues(it), it_2_1; it_2_1 = yield __await(it_2.next()), _b = it_2_1.done, !_b; _e = true) {
_d = it_2_1.value;
_e = false;
const v = _d;
const r = yield __await(mapper(v, i++));
if (r === END)
return yield __await(void 0);
if (r === SKIP)
continue;
yield yield __await(r);
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
if (!_e && !_b && (_c = it_2.return)) yield __await(_c.call(it_2));
}
finally { if (e_6) throw e_6.error; }
}
});
async *[Symbol.asyncIterator]() {
let i = 0;
for await (const v of it) {
const r = await mapper(v, i++);
if (r === END)
return;
if (r === SKIP)
continue;
yield r;
}
},

@@ -192,0 +107,0 @@ });

@@ -9,3 +9,2 @@ import { _uniq } from '../index';

export function mergeJsonSchemaObjects(s1, s2) {
var _a, _b;
// Merge `properties`

@@ -22,4 +21,4 @@ Object.entries(s2.properties).forEach(([k, v]) => {

s1.propertyNames = s2.propertyNames || s1.propertyNames;
s1.minProperties = (_a = s2.minProperties) !== null && _a !== void 0 ? _a : s1.minProperties;
s1.maxProperties = (_b = s2.maxProperties) !== null && _b !== void 0 ? _b : s1.maxProperties;
s1.minProperties = s2.minProperties ?? s1.minProperties;
s1.maxProperties = s2.maxProperties ?? s1.maxProperties;
// Merge `required`

@@ -26,0 +25,0 @@ s1.required.push(...s2.required);

@@ -253,3 +253,2 @@ import { _uniq } from '../array/array.util';

transformModify(t, add) {
var _a;
if (add) {

@@ -259,3 +258,3 @@ this.schema.transform = _uniq([...(this.schema.transform || []), t]);

else {
this.schema.transform = (_a = this.schema.transform) === null || _a === void 0 ? void 0 : _a.filter(s => s !== t);
this.schema.transform = this.schema.transform?.filter(s => s !== t);
}

@@ -262,0 +261,0 @@ return this;

@@ -17,3 +17,3 @@ import { _sortNumbers } from '../number/number.util';

export function _averageOrNull(values) {
return (values === null || values === void 0 ? void 0 : values.length) ? values.reduce((a, b) => a + b) / values.length : null;
return values?.length ? values.reduce((a, b) => a + b) / values.length : null;
}

@@ -20,0 +20,0 @@ /**

@@ -31,3 +31,3 @@ import { _isEmpty, _isObject } from '../is.util';

return r;
}, mutate ? obj : Object.assign({}, obj));
}, mutate ? obj : { ...obj });
}

@@ -79,3 +79,3 @@ /**

return r;
}, mutate ? obj : Object.assign({}, obj));
}, mutate ? obj : { ...obj });
}

@@ -139,4 +139,3 @@ /**

export function _findKeyByValue(obj, v) {
var _a;
return (_a = Object.entries(obj).find(([_, value]) => value === v)) === null || _a === void 0 ? void 0 : _a[0];
return Object.entries(obj).find(([_, value]) => value === v)?.[0];
}

@@ -283,3 +282,3 @@ export function _objectNullValuesToUndefined(obj, mutate = false) {

.split('.')
.reduce((o, p) => o === null || o === void 0 ? void 0 : o[p], obj);
.reduce((o, p) => o?.[p], obj);
}

@@ -286,0 +285,0 @@ /**

export function polyfillDispose() {
var _a, _b;
// @ts-expect-error polyfill
(_a = Symbol.dispose) !== null && _a !== void 0 ? _a : (Symbol.dispose = Symbol('Symbol.dispose'));
Symbol.dispose ?? (Symbol.dispose = Symbol('Symbol.dispose'));
// @ts-expect-error polyfill
(_b = Symbol.asyncDispose) !== null && _b !== void 0 ? _b : (Symbol.asyncDispose = Symbol('Symbol.asyncDispose'));
Symbol.asyncDispose ?? (Symbol.asyncDispose = Symbol('Symbol.asyncDispose'));
}

@@ -18,7 +18,6 @@ /**

abort() {
var _a;
if (this.aborted)
return;
this.aborted = true;
(_a = this.onAbort) === null || _a === void 0 ? void 0 : _a.call(this);
this.onAbort?.();
this.onAbort = undefined; // cleanup listener

@@ -25,0 +24,0 @@ }

@@ -99,3 +99,3 @@ import { END, ErrorMode, SKIP } from '..';

// otherwise, suppress (but still log via logger)
logger === null || logger === void 0 ? void 0 : logger.error(err);
logger?.error(err);
}

@@ -138,3 +138,3 @@ resolvingCount--;

// otherwise, suppress (but still log via logger)
logger === null || logger === void 0 ? void 0 : logger.error(err);
logger?.error(err);
}

@@ -169,3 +169,3 @@ }

// otherwise, suppress (but still log via logger)
logger === null || logger === void 0 ? void 0 : logger.error(r.reason);
logger?.error(r.reason);
}

@@ -172,0 +172,0 @@ }

@@ -16,5 +16,10 @@ import { ErrorMode } from '../error/errorMode';

this.onIdleListeners = [];
this.cfg = Object.assign({
this.cfg = {
// concurrency: Number.MAX_SAFE_INTEGER,
errorMode: ErrorMode.THROW_IMMEDIATELY, logger: console, debug: false, resolveOn: 'finish' }, cfg);
errorMode: ErrorMode.THROW_IMMEDIATELY,
logger: console,
debug: false,
resolveOn: 'finish',
...cfg,
};
if (!cfg.debug) {

@@ -21,0 +26,0 @@ this.debug = () => { };

@@ -14,3 +14,3 @@ import { JsonParseError } from '../error/error.util';

}
catch (_a) { }
catch { }
}

@@ -29,3 +29,3 @@ return obj;

}
catch (_a) { }
catch { }
}

@@ -43,3 +43,3 @@ }

}
catch (_a) {
catch {
throw new JsonParseError({

@@ -46,0 +46,0 @@ text: s,

@@ -98,3 +98,6 @@ /*

const words = countWords(text, options);
return Object.assign(Object.assign({}, readingTimeWithCount(words, options)), { words });
return {
...readingTimeWithCount(words, options),
words,
};
}

@@ -11,3 +11,3 @@ /**

}
catch (_a) {
catch {
// Native failed - resort to the "safe" serializer

@@ -21,3 +21,3 @@ return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);

const keys = [];
cycleReplacer !== null && cycleReplacer !== void 0 ? cycleReplacer : (cycleReplacer = function (key, value) {
cycleReplacer ?? (cycleReplacer = function (key, value) {
if (stack[0] === value)

@@ -24,0 +24,0 @@ return '[Circular ~]';

@@ -120,3 +120,3 @@ import { _isBackendErrorResponseObject, _isErrorLike, _isErrorObject } from '../error/error.util';

}
catch (_a) {
catch {
s = String(obj); // fallback

@@ -123,0 +123,0 @@ }

@@ -17,4 +17,3 @@ /// <reference lib="es2022"/>

getItem(key) {
var _a;
return (_a = this.data[key]) !== null && _a !== void 0 ? _a : null;
return this.data[key] ?? null;
}

@@ -28,4 +27,3 @@ setItem(key, value) {

key(index) {
var _a;
return (_a = Object.keys(this.data)[index]) !== null && _a !== void 0 ? _a : null;
return Object.keys(this.data)[index] ?? null;
}

@@ -32,0 +30,0 @@ clear() {

@@ -34,6 +34,5 @@ import { ZodError } from 'zod';

annotate() {
var _a;
let objectTitle = this.schema.description;
if (typeof this.value === 'object' && this.value) {
const objectName = this.schema.description || ((_a = this.value.constructor) === null || _a === void 0 ? void 0 : _a.name);
const objectName = this.schema.description || this.value.constructor?.name;
const objectId = this.value['id'];

@@ -40,0 +39,0 @@ objectTitle = [objectName, objectId].filter(Boolean).join('.');

{
"name": "@naturalcycles/js-lib",
"version": "14.235.0",
"version": "14.236.0",
"scripts": {

@@ -5,0 +5,0 @@ "prepare": "husky",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc