Socket
Socket
Sign inDemoInstall

@deepkit/core

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepkit/core - npm Package Compare versions

Comparing version 1.0.1-alpha.92 to 1.0.1-alpha.93

19

dist/cjs/src/core.d.ts

@@ -344,4 +344,23 @@ /**

export declare function escapeRegExp(string: string): string;
export declare function hasProperty(object: any, property: any): boolean;
/**
* Returns an iterator of numbers from start (inclusive) to stop (exclusive) by step.
*/
export declare function range(startOrLength: number, stop?: number, step?: number): IterableIterator<number>;
/**
* Returns an array of numbers from start (inclusive) to stop (exclusive) by step.
*
* Works the same as python's range function.
*/
export declare function rangeArray(startOrLength: number, stop?: number, step?: number): number[];
/**
* Returns a combined array of the given arrays.
*
* Works the same as python's zip function.
*/
export declare function zip<T extends (readonly unknown[])[]>(...args: T): {
[K in keyof T]: T[K] extends (infer V)[] ? V : never;
}[];
export declare type __ΩClassType = any[];
export declare type __ΩAbstractClassType = any[];
export declare type __ΩExtractClassType = any[];

52

dist/cjs/src/core.js

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

exports.getObjectKeysSize = exports.humanBytes = exports.deletePathValue = exports.setPathValue = exports.getPathValue = exports.time = exports.collectForMicrotask = exports.mergeStack = exports.createStack = exports.mergePromiseStack = exports.asyncOperation = exports.appendObject = exports.prependObjectKeys = exports.average = exports.last = exports.first = exports.lastKey = exports.firstKey = exports.size = exports.empty = exports.copy = exports.sleep = exports.indexOf = exports.isString = exports.isInteger = exports.isNumeric = exports.isNumber = exports.isSet = exports.isUndefined = exports.isNull = exports.isArray = exports.isObject = exports.isClass = exports.isPromise = exports.isAsyncFunction = exports.isFunction = exports.prettyPrintObject = exports.changeClass = exports.stringifyValueWithType = exports.isClassInstance = exports.getClassTypeFromInstance = exports.isPlainObject = exports.identifyType = exports.applyDefaults = exports.getClassPropertyName = exports.getClassName = exports.__ΩExtractClassType = exports.__ΩAbstractClassType = exports.__ΩClassType = exports.CustomError = void 0;
exports.escapeRegExp = exports.getCurrentFileName = exports.isIterable = exports.createDynamicClass = exports.inDebugMode = exports.getParentClass = exports.isPrototypeOfBase = exports.isConstructable = void 0;
exports.zip = exports.rangeArray = exports.range = exports.hasProperty = exports.escapeRegExp = exports.getCurrentFileName = exports.isIterable = exports.createDynamicClass = exports.inDebugMode = exports.getParentClass = exports.isPrototypeOfBase = exports.isConstructable = void 0;
function __assignType(fn, args) {

@@ -13,5 +13,10 @@ fn.__type = args;

}
const __ΩIteratorYieldResult = ['TYield', false, 'done', 'value', 'b!P."4#8e"!4$M'];
const __ΩIteratorReturnResult = ['TReturn', true, 'done', 'value', 'b!P."4#e"!4$M'];
const __ΩIteratorResult = ['T', 'TReturn', () => __ΩIteratorYieldResult, () => __ΩIteratorReturnResult, 'b!"c"Pe"!o#"e""o$"J'];
const __ΩPropertyKey = ['P&\'+J'];
const __ΩIterator = ['T', 'TReturn', 'TNext', 'args', () => __ΩIteratorResult, 'next', 'value', () => __ΩIteratorResult, 'return', 'e', () => __ΩIteratorResult, 'throw', 'b!"c"-c#PPPPGPe%#GJ@2$e#!e#"o%#1&Pe#"2\'8e#!e#"o(#1)P"2*8e#!e#"o+#1,M'];
const __ΩObject = ['', 'constructor', 'toString', 'toLocaleString', 0, 'valueOf', () => __ΩPropertyKey, 'v', 'hasOwnProperty', 0, 'isPrototypeOf', () => __ΩPropertyKey, 'propertyIsEnumerable', 'PP"/!4"P&1#P&1$Pn%1&Pn\'2()1)Pn*2()1+Pn,2()1-M'];
const __ΩError = ['name', 'message', 'stack', 'P&4!&4"&4#8M'];
const __ΩIterableIterator = ['T', () => __ΩIterator, 0, () => Symbol.iterator, 'b!Pe"!o""Pe#!o#"1$M'];
/*

@@ -643,2 +648,4 @@ * Deepkit Framework

function getPathValue(bag, parameterPath, defaultValue) {
if (parameterPath === '' || parameterPath === undefined)
return bag;
if (isSet(bag[parameterPath])) {

@@ -786,2 +793,45 @@ return bag[parameterPath];

escapeRegExp.__type = ['string', 'escapeRegExp', 'P&2!&/"'];
function hasProperty(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
}
exports.hasProperty = hasProperty;
hasProperty.__type = ['object', 'property', 'hasProperty', 'P"2!"2")/#'];
/**
* Returns an iterator of numbers from start (inclusive) to stop (exclusive) by step.
*/
function* range(startOrLength, stop = 0, step = 1) {
let i = startOrLength;
let end = stop;
if (stop === 0) {
i = 0;
end = startOrLength;
}
for (; i < end; i += step) {
yield i;
}
}
exports.range = range;
range.__type = ['startOrLength', 'stop', () => 0, 'step', () => 1, () => __ΩIterableIterator, 'range', 'P\'2!\'2">#\'2$>%\'o&"/\''];
/**
* Returns an array of numbers from start (inclusive) to stop (exclusive) by step.
*
* Works the same as python's range function.
*/
function rangeArray(startOrLength, stop = 0, step = 1) {
return [...range(startOrLength, stop, step)];
}
exports.rangeArray = rangeArray;
rangeArray.__type = ['startOrLength', 'stop', () => 0, 'step', () => 1, 'rangeArray', 'P\'2!\'2">#\'2$>%\'F/&'];
/**
* Returns a combined array of the given arrays.
*
* Works the same as python's zip function.
*/
function zip(...args) {
const minLength = Math.min(...args.map(__assignType((arr) => arr.length, ['arr', '', 'P"2!"/"'])));
//@ts-ignore
return Array.from({ length: minLength }).map(__assignType((_, i) => args.map(__assignType((arr) => arr[i], ['arr', '', 'P"2!"/"'])), ['_', 'i', '', 'P"2!"2""/#']));
}
exports.zip = zip;
zip.__type = ['args', 'zip', 'l:e"!R!RPd"e#!fh!!Fqk#\'QRP"@2!Pd"gN)!F/"'];
//# sourceMappingURL=core.js.map

@@ -0,1 +1,20 @@

/**
* Wraps a function and calls it only `cps` times per frame.
*
* This is handy to throttle all kind of rapid calls, like mouse move events or other kind of events.
*
* @example
* ```typescript
* function expensiveFunction() {
* //...
* }
*
* const throttled = throttleTime(expensiveFunction, 5); //5 calls per second max
*
* throttled();
* throttled();
* throttled();
* //throttled will here only be called once
* ```
*/
export declare function throttleTime(call: Function, cps?: number): (...args: any[]) => void;

@@ -2,0 +21,0 @@ /**

@@ -17,2 +17,23 @@ "use strict";

*/
const nextTick = typeof requestAnimationFrame !== 'undefined'
? __assignType((cb) => requestAnimationFrame(() => cb), ['', 'cb', 'PP$/!2""/!']) : __assignType((cb) => setTimeout(cb), ['', 'cb', 'PP$/!2""/!']);
/**
* Wraps a function and calls it only `cps` times per frame.
*
* This is handy to throttle all kind of rapid calls, like mouse move events or other kind of events.
*
* @example
* ```typescript
* function expensiveFunction() {
* //...
* }
*
* const throttled = throttleTime(expensiveFunction, 5); //5 calls per second max
*
* throttled();
* throttled();
* throttled();
* //throttled will here only be called once
* ```
*/
function throttleTime(call, cps = 5) {

@@ -33,3 +54,3 @@ let last = Date.now();

if (dirty) {
requestAnimationFrame(tick);
nextTick(tick);
}

@@ -36,0 +57,0 @@ }

@@ -344,4 +344,23 @@ /**

export declare function escapeRegExp(string: string): string;
export declare function hasProperty(object: any, property: any): boolean;
/**
* Returns an iterator of numbers from start (inclusive) to stop (exclusive) by step.
*/
export declare function range(startOrLength: number, stop?: number, step?: number): IterableIterator<number>;
/**
* Returns an array of numbers from start (inclusive) to stop (exclusive) by step.
*
* Works the same as python's range function.
*/
export declare function rangeArray(startOrLength: number, stop?: number, step?: number): number[];
/**
* Returns a combined array of the given arrays.
*
* Works the same as python's zip function.
*/
export declare function zip<T extends (readonly unknown[])[]>(...args: T): {
[K in keyof T]: T[K] extends (infer V)[] ? V : never;
}[];
export declare type __ΩClassType = any[];
export declare type __ΩAbstractClassType = any[];
export declare type __ΩExtractClassType = any[];

@@ -5,5 +5,10 @@ function __assignType(fn, args) {

}
const __ΩIteratorYieldResult = ['TYield', false, 'done', 'value', 'b!P."4#8e"!4$M'];
const __ΩIteratorReturnResult = ['TReturn', true, 'done', 'value', 'b!P."4#e"!4$M'];
const __ΩIteratorResult = ['T', 'TReturn', () => __ΩIteratorYieldResult, () => __ΩIteratorReturnResult, 'b!"c"Pe"!o#"e""o$"J'];
const __ΩPropertyKey = ['P&\'+J'];
const __ΩIterator = ['T', 'TReturn', 'TNext', 'args', () => __ΩIteratorResult, 'next', 'value', () => __ΩIteratorResult, 'return', 'e', () => __ΩIteratorResult, 'throw', 'b!"c"-c#PPPPGPe%#GJ@2$e#!e#"o%#1&Pe#"2\'8e#!e#"o(#1)P"2*8e#!e#"o+#1,M'];
const __ΩObject = ['', 'constructor', 'toString', 'toLocaleString', 0, 'valueOf', () => __ΩPropertyKey, 'v', 'hasOwnProperty', 0, 'isPrototypeOf', () => __ΩPropertyKey, 'propertyIsEnumerable', 'PP"/!4"P&1#P&1$Pn%1&Pn\'2()1)Pn*2()1+Pn,2()1-M'];
const __ΩError = ['name', 'message', 'stack', 'P&4!&4"&4#8M'];
const __ΩIterableIterator = ['T', () => __ΩIterator, 0, () => Symbol.iterator, 'b!Pe"!o""Pe#!o#"1$M'];
/*

@@ -594,2 +599,4 @@ * Deepkit Framework

export function getPathValue(bag, parameterPath, defaultValue) {
if (parameterPath === '' || parameterPath === undefined)
return bag;
if (isSet(bag[parameterPath])) {

@@ -724,2 +731,41 @@ return bag[parameterPath];

escapeRegExp.__type = ['string', 'escapeRegExp', 'P&2!&/"'];
export function hasProperty(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
}
hasProperty.__type = ['object', 'property', 'hasProperty', 'P"2!"2")/#'];
/**
* Returns an iterator of numbers from start (inclusive) to stop (exclusive) by step.
*/
export function* range(startOrLength, stop = 0, step = 1) {
let i = startOrLength;
let end = stop;
if (stop === 0) {
i = 0;
end = startOrLength;
}
for (; i < end; i += step) {
yield i;
}
}
range.__type = ['startOrLength', 'stop', () => 0, 'step', () => 1, () => __ΩIterableIterator, 'range', 'P\'2!\'2">#\'2$>%\'o&"/\''];
/**
* Returns an array of numbers from start (inclusive) to stop (exclusive) by step.
*
* Works the same as python's range function.
*/
export function rangeArray(startOrLength, stop = 0, step = 1) {
return [...range(startOrLength, stop, step)];
}
rangeArray.__type = ['startOrLength', 'stop', () => 0, 'step', () => 1, 'rangeArray', 'P\'2!\'2">#\'2$>%\'F/&'];
/**
* Returns a combined array of the given arrays.
*
* Works the same as python's zip function.
*/
export function zip(...args) {
const minLength = Math.min(...args.map(__assignType((arr) => arr.length, ['arr', '', 'P"2!"/"'])));
//@ts-ignore
return Array.from({ length: minLength }).map(__assignType((_, i) => args.map(__assignType((arr) => arr[i], ['arr', '', 'P"2!"/"'])), ['_', 'i', '', 'P"2!"2""/#']));
}
zip.__type = ['args', 'zip', 'l:e"!R!RPd"e#!fh!!Fqk#\'QRP"@2!Pd"gN)!F/"'];
//# sourceMappingURL=core.js.map

@@ -0,1 +1,20 @@

/**
* Wraps a function and calls it only `cps` times per frame.
*
* This is handy to throttle all kind of rapid calls, like mouse move events or other kind of events.
*
* @example
* ```typescript
* function expensiveFunction() {
* //...
* }
*
* const throttled = throttleTime(expensiveFunction, 5); //5 calls per second max
*
* throttled();
* throttled();
* throttled();
* //throttled will here only be called once
* ```
*/
export declare function throttleTime(call: Function, cps?: number): (...args: any[]) => void;

@@ -2,0 +21,0 @@ /**

@@ -14,2 +14,23 @@ function __assignType(fn, args) {

*/
const nextTick = typeof requestAnimationFrame !== 'undefined'
? __assignType((cb) => requestAnimationFrame(() => cb), ['', 'cb', 'PP$/!2""/!']) : __assignType((cb) => setTimeout(cb), ['', 'cb', 'PP$/!2""/!']);
/**
* Wraps a function and calls it only `cps` times per frame.
*
* This is handy to throttle all kind of rapid calls, like mouse move events or other kind of events.
*
* @example
* ```typescript
* function expensiveFunction() {
* //...
* }
*
* const throttled = throttleTime(expensiveFunction, 5); //5 calls per second max
*
* throttled();
* throttled();
* throttled();
* //throttled will here only be called once
* ```
*/
export function throttleTime(call, cps = 5) {

@@ -30,3 +51,3 @@ let last = Date.now();

if (dirty) {
requestAnimationFrame(tick);
nextTick(tick);
}

@@ -33,0 +54,0 @@ }

4

package.json
{
"name": "@deepkit/core",
"version": "1.0.1-alpha.92",
"version": "1.0.1-alpha.93",
"description": "Deepkit core library",

@@ -44,3 +44,3 @@ "type": "commonjs",

},
"gitHead": "213c7deb1a8792cc64dc89d4a06c4db3d891b808"
"gitHead": "1e84c15f9b6a27aee55239564f31023062f55637"
}

@@ -595,2 +595,3 @@ /*

export function getPathValue(bag: { [field: string]: any }, parameterPath: string, defaultValue?: any): any {
if (parameterPath === '' || parameterPath === undefined) return bag;
if (isSet(bag[parameterPath])) {

@@ -721,1 +722,43 @@ return bag[parameterPath];

}
export function hasProperty(object: any, property: any): boolean {
return Object.prototype.hasOwnProperty.call(object, property);
}
/**
* Returns an iterator of numbers from start (inclusive) to stop (exclusive) by step.
*/
export function* range(startOrLength: number, stop: number = 0, step: number = 1): IterableIterator<number> {
let i = startOrLength;
let end = stop;
if (stop === 0) {
i = 0;
end = startOrLength;
}
for (; i < end; i += step) {
yield i;
}
}
/**
* Returns an array of numbers from start (inclusive) to stop (exclusive) by step.
*
* Works the same as python's range function.
*/
export function rangeArray(startOrLength: number, stop: number = 0, step: number = 1): number[] {
return [...range(startOrLength, stop, step)];
}
/**
* Returns a combined array of the given arrays.
*
* Works the same as python's zip function.
*/
export function zip<T extends (readonly unknown[])[]>(
...args: T
): { [K in keyof T]: T[K] extends (infer V)[] ? V : never }[] {
const minLength = Math.min(...args.map((arr) => arr.length));
//@ts-ignore
return Array.from({ length: minLength }).map((_, i) => args.map((arr) => arr[i]));
}

@@ -11,2 +11,24 @@ /*

const nextTick = typeof requestAnimationFrame !== 'undefined'
? (cb: () => void) => requestAnimationFrame(() => cb) : (cb: () => void) => setTimeout(cb);
/**
* Wraps a function and calls it only `cps` times per frame.
*
* This is handy to throttle all kind of rapid calls, like mouse move events or other kind of events.
*
* @example
* ```typescript
* function expensiveFunction() {
* //...
* }
*
* const throttled = throttleTime(expensiveFunction, 5); //5 calls per second max
*
* throttled();
* throttled();
* throttled();
* //throttled will here only be called once
* ```
*/
export function throttleTime(call: Function, cps = 5): (...args: any[]) => void {

@@ -30,3 +52,3 @@ let last = Date.now();

if (dirty) {
requestAnimationFrame(tick);
nextTick(tick);
}

@@ -33,0 +55,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

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