@naturalcycles/js-lib
Advanced tools
Comparing version 14.251.0 to 14.252.0
@@ -246,2 +246,3 @@ import { _assert } from '../error/assert'; | ||
plus(num, unit, mutate = false) { | ||
num = Math.floor(num); // if a fractional number like 0.5 is passed - it will be floored, as LocalDate only deals with "whole days" as minimal unit | ||
let { day, month, year } = this; | ||
@@ -248,0 +249,0 @@ if (unit === 'week') { |
import { _debounce, _throttle } from './debounce'; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export function _Debounce(wait, opt = {}) { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -12,3 +12,3 @@ descriptor.value = _debounce(originalFn, wait, opt); | ||
export function _Throttle(wait, opt = {}) { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -15,0 +15,0 @@ descriptor.value = _throttle(originalFn, wait, opt); |
import { pRetryFn } from '..'; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export function _Retry(opt = {}) { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -6,0 +6,0 @@ descriptor.value = pRetryFn(originalFn, opt); |
@@ -92,3 +92,3 @@ import { _mapObject, _mapValues } from './object/object.util'; | ||
export function _defineProps(obj, props) { | ||
return Object.defineProperties(obj, _mapValues(props, (k, pd) => ({ | ||
return Object.defineProperties(obj, _mapValues(props, (_k, pd) => ({ | ||
writable: true, | ||
@@ -95,0 +95,0 @@ configurable: true, |
@@ -37,3 +37,3 @@ import { _anyToError, _since } from '../index'; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export const _TryCatch = (opt = {}) => (target, key, descriptor) => { | ||
export const _TryCatch = (opt = {}) => (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -40,0 +40,0 @@ descriptor.value = _tryCatch(originalFn, opt); |
@@ -282,3 +282,2 @@ import { _isEmpty, _isObject } from '../is.util'; | ||
} | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (obj.hasOwnProperty(prop)) { | ||
@@ -401,3 +400,3 @@ delete obj[prop]; | ||
Object.getOwnPropertyNames(o).forEach(prop => { | ||
if (o.hasOwnProperty(prop) && // eslint-disable-line no-prototype-builtins | ||
if (o.hasOwnProperty(prop) && | ||
o[prop] !== null && | ||
@@ -404,0 +403,0 @@ (typeof o[prop] === 'object' || typeof o[prop] === 'function') && |
export async function pFilter(iterable, filterFn) { | ||
const items = [...iterable]; | ||
const predicates = await Promise.all(items.map((item, i) => filterFn(item, i))); | ||
return items.filter((item, i) => predicates[i]); | ||
return items.filter((_item, i) => predicates[i]); | ||
} |
@@ -32,3 +32,3 @@ import { _errorDataAppend, TimeoutError } from '../error/error.util'; | ||
const fakeError = opt.fakeError || new Error('TimeoutError'); | ||
// eslint-disable-next-line no-async-promise-executor | ||
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: ok | ||
return await new Promise(async (resolve, reject) => { | ||
@@ -35,0 +35,0 @@ // Prepare the timeout timer |
@@ -20,3 +20,3 @@ /** | ||
const keys = []; | ||
cycleReplacer ?? (cycleReplacer = (key, value) => { | ||
cycleReplacer ?? (cycleReplacer = (_key, value) => { | ||
if (stack[0] === value) | ||
@@ -23,0 +23,0 @@ return '[Circular ~]'; |
@@ -249,2 +249,3 @@ "use strict"; | ||
plus(num, unit, mutate = false) { | ||
num = Math.floor(num); // if a fractional number like 0.5 is passed - it will be floored, as LocalDate only deals with "whole days" as minimal unit | ||
let { day, month, year } = this; | ||
@@ -251,0 +252,0 @@ if (unit === 'week') { |
@@ -8,3 +8,3 @@ "use strict"; | ||
function _Debounce(wait, opt = {}) { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -17,3 +17,3 @@ descriptor.value = (0, debounce_1._debounce)(originalFn, wait, opt); | ||
function _Throttle(wait, opt = {}) { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -20,0 +20,0 @@ descriptor.value = (0, debounce_1._throttle)(originalFn, wait, opt); |
@@ -7,3 +7,3 @@ "use strict"; | ||
function _Retry(opt = {}) { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -10,0 +10,0 @@ descriptor.value = (0, __1.pRetryFn)(originalFn, opt); |
@@ -100,3 +100,3 @@ "use strict"; | ||
function _defineProps(obj, props) { | ||
return Object.defineProperties(obj, (0, object_util_1._mapValues)(props, (k, pd) => ({ | ||
return Object.defineProperties(obj, (0, object_util_1._mapValues)(props, (_k, pd) => ({ | ||
writable: true, | ||
@@ -103,0 +103,0 @@ configurable: true, |
@@ -41,3 +41,3 @@ "use strict"; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const _TryCatch = (opt = {}) => (target, key, descriptor) => { | ||
const _TryCatch = (opt = {}) => (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value; | ||
@@ -44,0 +44,0 @@ descriptor.value = _tryCatch(originalFn, opt); |
@@ -311,3 +311,2 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (obj.hasOwnProperty(prop)) { | ||
@@ -430,3 +429,3 @@ delete obj[prop]; | ||
Object.getOwnPropertyNames(o).forEach(prop => { | ||
if (o.hasOwnProperty(prop) && // eslint-disable-line no-prototype-builtins | ||
if (o.hasOwnProperty(prop) && | ||
o[prop] !== null && | ||
@@ -433,0 +432,0 @@ (typeof o[prop] === 'object' || typeof o[prop] === 'function') && |
@@ -7,3 +7,3 @@ "use strict"; | ||
const predicates = await Promise.all(items.map((item, i) => filterFn(item, i))); | ||
return items.filter((item, i) => predicates[i]); | ||
return items.filter((_item, i) => predicates[i]); | ||
} |
@@ -36,3 +36,3 @@ "use strict"; | ||
const fakeError = opt.fakeError || new Error('TimeoutError'); | ||
// eslint-disable-next-line no-async-promise-executor | ||
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: ok | ||
return await new Promise(async (resolve, reject) => { | ||
@@ -39,0 +39,0 @@ // Prepare the timeout timer |
@@ -23,3 +23,3 @@ "use strict"; | ||
const keys = []; | ||
cycleReplacer ??= (key, value) => { | ||
cycleReplacer ??= (_key, value) => { | ||
if (stack[0] === value) | ||
@@ -26,0 +26,0 @@ return '[Circular ~]'; |
{ | ||
"name": "@naturalcycles/js-lib", | ||
"version": "14.251.0", | ||
"version": "14.252.0", | ||
"scripts": { | ||
@@ -49,3 +49,3 @@ "prepare": "husky", | ||
"engines": { | ||
"node": ">=18.12.0" | ||
"node": ">=20.13.0" | ||
}, | ||
@@ -52,0 +52,0 @@ "publishConfig": { |
import { AsyncIterable2 } from '../iter/asyncIterable2' | ||
import { Iterable2 } from '../iter/iterable2' | ||
/* eslint-disable no-redeclare, unicorn/no-new-array */ | ||
/* eslint-disable unicorn/no-new-array */ | ||
@@ -6,0 +6,0 @@ /** |
@@ -290,2 +290,3 @@ import { _assert } from '../error/assert' | ||
plus(num: number, unit: LocalDateUnit, mutate = false): LocalDate { | ||
num = Math.floor(num) // if a fractional number like 0.5 is passed - it will be floored, as LocalDate only deals with "whole days" as minimal unit | ||
let { day, month, year } = this | ||
@@ -292,0 +293,0 @@ |
@@ -6,3 +6,3 @@ import type { DebounceOptions, ThrottleOptions } from './debounce' | ||
export function _Debounce(wait: number, opt: DebounceOptions = {}): MethodDecorator { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value | ||
@@ -16,3 +16,3 @@ descriptor.value = _debounce(originalFn as any, wait, opt) | ||
export function _Throttle(wait: number, opt: ThrottleOptions = {}): MethodDecorator { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value | ||
@@ -19,0 +19,0 @@ descriptor.value = _throttle(originalFn as any, wait, opt) |
@@ -6,3 +6,3 @@ import type { PRetryOptions } from '..' | ||
export function _Retry(opt: PRetryOptions = {}): MethodDecorator { | ||
return (target, key, descriptor) => { | ||
return (_target, _key, descriptor) => { | ||
const originalFn = descriptor.value | ||
@@ -9,0 +9,0 @@ descriptor.value = pRetryFn(originalFn as any, opt) |
@@ -118,3 +118,3 @@ import { _mapObject, _mapValues } from './object/object.util' | ||
obj, | ||
_mapValues(props, (k, pd) => ({ | ||
_mapValues(props, (_k, pd) => ({ | ||
writable: true, | ||
@@ -121,0 +121,0 @@ configurable: true, |
@@ -70,3 +70,3 @@ import type { CommonLogger } from '../index' | ||
(opt: TryCatchOptions = {}): MethodDecorator => | ||
(target, key, descriptor) => { | ||
(_target, _key, descriptor) => { | ||
const originalFn = descriptor.value | ||
@@ -73,0 +73,0 @@ descriptor.value = _tryCatch(originalFn as any, opt) |
@@ -335,3 +335,3 @@ import { _isEmpty, _isObject } from '../is.util' | ||
} | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (obj.hasOwnProperty(prop)) { | ||
@@ -474,3 +474,3 @@ delete obj[prop] | ||
if ( | ||
o.hasOwnProperty(prop) && // eslint-disable-line no-prototype-builtins | ||
o.hasOwnProperty(prop) && | ||
o[prop] !== null && | ||
@@ -477,0 +477,0 @@ (typeof o[prop] === 'object' || typeof o[prop] === 'function') && |
@@ -6,3 +6,3 @@ import type { AsyncPredicate } from '../types' | ||
const predicates = await Promise.all(items.map((item, i) => filterFn(item, i))) | ||
return items.filter((item, i) => predicates[i]) | ||
return items.filter((_item, i) => predicates[i]) | ||
} |
@@ -75,3 +75,3 @@ import type { ErrorData } from '../error/error.model' | ||
// eslint-disable-next-line no-async-promise-executor | ||
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: ok | ||
return await new Promise(async (resolve, reject) => { | ||
@@ -78,0 +78,0 @@ // Prepare the timeout timer |
@@ -29,3 +29,3 @@ import type { Reviver } from '../types' | ||
cycleReplacer ??= (key, value) => { | ||
cycleReplacer ??= (_key, value) => { | ||
if (stack[0] === value) return '[Circular ~]' | ||
@@ -32,0 +32,0 @@ return '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']' |
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
1077111