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

@kakasoo/proto-typescript

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kakasoo/proto-typescript - npm Package Compare versions

Comparing version 1.27.1 to 1.27.2

2

dist/classes/typed-array.class.d.ts

@@ -55,3 +55,3 @@ import { ToPrimitive } from '../interfaces/to-primitive.interface';

*/
some<Target>(predicate: <INNER_TARGET = Target, Index extends number = number>(value: ArrayType.At<ParseToArray<T>, Index>, index: Index, array: ParseToArray<T>) => ArrayType.Some<INNER_TARGET, ParseToArray<T>>): ReturnType<typeof ArrayPrototype.some>;
some<Target>(predicate: ArrayType.TypePredicate<ParseToArray<T>, Target>): ReturnType<typeof ArrayPrototype.some>;
/**

@@ -58,0 +58,0 @@ * @inheritdoc

@@ -1,6 +0,3 @@

import { ArrayType, NumberType } from '../types';
import { ArrayType, Equal, NumberType } from '../types';
import { ReadonlyOrNot } from '../types/primitive.type';
type TypePredicate<Container extends ReadonlyOrNot<any[]>, Target> = {
<Index extends number, __Target extends Target = Target>(value: ArrayType.At<Container, Index>, index?: Index, array?: Container): value is Target;
};
export declare const ArrayPrototype: {

@@ -13,7 +10,18 @@ /**

* const answer = ArrayPrototype.filter<[1, 2, 3, 4, 5], 2>([1, 2, 3, 4, 5] as const, (el: any): el is 2 => el === 2);
* const answer = ArrayPrototype.filter([1, 2, 3, 4, 5] as const, (el: any): el is 3 => el === 3);
* ```
* @returns
*/
filter<Container extends ReadonlyOrNot<any[]>, Target = any>(container: Container, predicate: TypePredicate<Container, Target>): ArrayType.Filter<Container, Target>;
filter<Container extends ReadonlyOrNot<any[]>, Target = any>(container: Container, predicate: ArrayType.TypePredicate<Container, Target>): Equal<Target, unknown> extends true ? boolean : Equal<Target, any> extends true ? boolean : ArrayType.Filter<Container, Target>;
/**
* Filter `null` or `undefined` element of Array Container.
* @param container
* @param predicate filtering options
* @returns
*/
filterNullish<Container_1 extends ReadonlyOrNot<any[]>, FilterNull extends boolean, FilterUndefined extends boolean>(container: Container_1, predicate: {
filterNull: FilterNull;
filterUndefined: FilterUndefined;
}): ArrayType.FilterNullish<Container_1, FilterNull, FilterUndefined>;
/**
* It only returns the 0th index without subtracting the elements inside the actual container.

@@ -23,3 +31,3 @@ * @param conatiner

*/
shift<Conatiner extends ReadonlyOrNot<any[]>>(conatiner: Conatiner): ArrayType.At<Conatiner, 0>;
shift<Container_2 extends ReadonlyOrNot<any[]>>(conatiner: Container_2): ArrayType.At<Container_2, 0>;
/**

@@ -30,3 +38,3 @@ * Only return the last index without subtracting the elements inside the actual container.

*/
pop<Conatiner_1 extends ReadonlyOrNot<any[]>>(conatiner: Conatiner_1): ArrayType.At<Conatiner_1, NumberType.Sub<ArrayType.Length<Conatiner_1>, 1>>;
pop<Container_3 extends ReadonlyOrNot<any[]>>(conatiner: Container_3): ArrayType.At<Container_3, NumberType.Sub<ArrayType.Length<Container_3>, 1>>;
/**

@@ -37,3 +45,3 @@ * @param container

*/
unshift<Conatiner_2 extends ReadonlyOrNot<any[]>, Items extends ReadonlyOrNot<any[]>>(container: Conatiner_2, ...items: Items): [...Items, ...Conatiner_2];
unshift<Container_4 extends ReadonlyOrNot<any[]>, Items extends ReadonlyOrNot<any[]>>(container: Container_4, ...items: Items): [...Items, ...Container_4];
/**

@@ -46,3 +54,3 @@ * @todo add paramter of this method, named `thisArg`.

*/
some<Target_1, Conatiner_3 extends ReadonlyOrNot<any[]>>(container: Conatiner_3, predicate: <INNER_TARGET = Target_1, Index extends number = number>(value: ArrayType.At<Conatiner_3, Index>, index: Index, array: Conatiner_3) => ArrayType.Some<INNER_TARGET, Conatiner_3>): boolean;
some<Container_5 extends ReadonlyOrNot<any[]>, Target_1 = any>(container: Container_5, predicate: ArrayType.TypePredicate<Container_5, Target_1>, thisArg?: any): Equal<Target_1, unknown> extends true ? boolean : Equal<Target_1, any> extends true ? boolean : ArrayType.Includes<Container_5, Target_1>;
/**

@@ -53,8 +61,7 @@ * @param container

*/
push<Conatiner_4 extends ReadonlyOrNot<any[]>, Items_1 extends ReadonlyOrNot<any[]>>(container: Conatiner_4, ...items: Items_1): [...Conatiner_4, ...Items_1];
push<Container_6 extends ReadonlyOrNot<any[]>, Items_1 extends ReadonlyOrNot<any[]>>(container: Container_6, ...items: Items_1): [...Container_6, ...Items_1];
/**
* @inheritdoc
* @param container
*/
at<Container_1 extends ReadonlyOrNot<any[]>, Index_1 extends number>(container: Container_1, index: Index_1): ArrayType.At<Container_1, Index_1>;
at<Container_7 extends ReadonlyOrNot<any[]>, Index extends number>(container: Container_7, index: Index): ArrayType.At<Container_7, Index>;
/**

@@ -65,3 +72,2 @@ * type-safe join.

*
* @inheritdoc
* @param container

@@ -72,5 +78,4 @@ * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

*/
join<Container_2 extends ReadonlyOrNot<(string | number | bigint | boolean | null | undefined)[]>, Separator extends string = ",">(container: Container_2, separator?: Separator): ArrayType.Join<Container_2, Separator>;
join<Container_8 extends ReadonlyOrNot<(string | number | bigint | boolean | null | undefined)[]>, Separator extends string = ",">(container: Container_8, separator?: Separator): ArrayType.Join<Container_8, Separator>;
};
export {};
//# sourceMappingURL=array.prototype.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArrayPrototype = void 0;
/**
* Filter `null` or `undefined` element of Array Container.
* @param container
* @param predicate filtering options
* @returns
*/
function filterNullish(container, predicate) {
return container.filter((element) => {
if (predicate.filterNull === true) {
return element !== null;
}
if (predicate.filterUndefined === true) {
return element !== undefined;
}
return true;
});
}
exports.ArrayPrototype = {

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

* const answer = ArrayPrototype.filter<[1, 2, 3, 4, 5], 2>([1, 2, 3, 4, 5] as const, (el: any): el is 2 => el === 2);
* const answer = ArrayPrototype.filter([1, 2, 3, 4, 5] as const, (el: any): el is 3 => el === 3);
* ```

@@ -36,2 +20,19 @@ * @returns

/**
* Filter `null` or `undefined` element of Array Container.
* @param container
* @param predicate filtering options
* @returns
*/
filterNullish(container, predicate) {
return container.filter((element) => {
if (predicate.filterNull === true) {
return element !== null;
}
if (predicate.filterUndefined === true) {
return element !== undefined;
}
return true;
});
},
/**
* It only returns the 0th index without subtracting the elements inside the actual container.

@@ -67,9 +68,4 @@ * @param conatiner

*/
some(container, predicate) {
for (let i = 0; i < container.length; i++) {
if (predicate(container[i], i, container)) {
return true;
}
}
return false;
some(container, predicate, thisArg) {
return container.some(predicate);
},

@@ -85,3 +81,2 @@ /**

/**
* @inheritdoc
* @param container

@@ -97,3 +92,2 @@ */

*
* @inheritdoc
* @param container

@@ -100,0 +94,0 @@ * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

@@ -6,2 +6,5 @@ import { NeverType } from './never.type';

export declare namespace ArrayType {
export type TypePredicate<Container extends ReadonlyOrNot<any[]>, Target extends any = any> = {
<Index extends number, __Target extends Target = Target>(value: ArrayType.At<Container, Index>, index?: Index, array?: Container): value is Target;
};
/**

@@ -8,0 +11,0 @@ * @todo don't use `Equal` type and use `includes` of `union types` ( make `union incldues` type )

{
"name": "@kakasoo/proto-typescript",
"version": "1.27.1",
"version": "1.27.2",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

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