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

@opencreek/ext

Package Overview
Dependencies
Maintainers
2
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencreek/ext - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0--canary.1.c7fdd1ae303a59b3ef529a08735b2d44b9564296.0

build/collections.d.ts

11

build/extendPrototype.d.ts

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

export default function extendProtoype(target: Function, func: Function, functionName: string): void;
export declare function extendProtoype(target: Function, func: Function, functionName: string): void;
declare type ThisFunction<F extends (...args: any) => any> = (this: FirstParameter<F>, ...args: SkipFirstParameter<F>) => ReturnType<F>;
declare type FirstParameter<F extends (...args: any) => any> = Parameters<F> extends [
infer T,
...infer _
] ? T : never;
declare type SkipFirst<T extends unknown[]> = T extends [infer _, ...infer R] ? [...R] : never;
declare type SkipFirstParameter<F extends (...args: any) => any> = SkipFirst<Parameters<F>>;
export declare function apply<F extends (...args: any) => any>(f: F): ThisFunction<F>;
export {};
//# sourceMappingURL=extendPrototype.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.apply = exports.extendProtoype = void 0;
/* eslint-disable @typescript-eslint/ban-types */

@@ -12,3 +13,9 @@ function extendProtoype(target, func, functionName) {

}
exports.default = extendProtoype;
exports.extendProtoype = extendProtoype;
function apply(f) {
return function (...b) {
return f(this, ...b);
};
}
exports.apply = apply;
//# sourceMappingURL=extendPrototype.js.map

@@ -5,2 +5,4 @@ export * from "./error";

export * from "./raise";
export * from "./collections";
export * from "./objects";
//# sourceMappingURL=index.d.ts.map

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

__exportStar(require("./raise"), exports);
__exportStar(require("./collections"), exports);
__exportStar(require("./objects"), exports);
//# sourceMappingURL=index.js.map

5

package.json
{
"name": "@opencreek/ext",
"version": "1.0.2",
"version": "1.1.0--canary.1.c7fdd1ae303a59b3ef529a08735b2d44b9564296.0",
"description": "",

@@ -37,3 +37,6 @@ "main": "build/index.js",

"semi": false
},
"dependencies": {
"@opencreek/deno-std-collections": "^0.109.0"
}
}

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

# typescript-extensions
# typescript-extensions

@@ -5,6 +5,4 @@ /**

*/
export function error(
msg?: string
): never {
throw new Error(msg)
export function error(msg?: string): never {
throw new Error(msg)
}
/* eslint-disable @typescript-eslint/ban-types */
export default function extendProtoype(
target: Function,
func: Function,
functionName: string
export function extendProtoype(
target: Function,
func: Function,
functionName: string
): void {
if (!Object.getOwnPropertyNames(target.prototype).includes(functionName)) {
Object.defineProperty(target.prototype, functionName, {
value: func,
writable: true,
})
}
if (!Object.getOwnPropertyNames(target.prototype).includes(functionName)) {
Object.defineProperty(target.prototype, functionName, {
value: func,
writable: true,
})
}
}
type ThisFunction<F extends (...args: any) => any> = (
this: FirstParameter<F>,
...args: SkipFirstParameter<F>
) => ReturnType<F>
type FirstParameter<F extends (...args: any) => any> = Parameters<F> extends [
infer T,
...infer _
]
? T
: never
type SkipFirst<T extends unknown[]> = T extends [infer _, ...infer R]
? [...R]
: never
type SkipFirstParameter<F extends (...args: any) => any> = SkipFirst<
Parameters<F>
>
export function apply<F extends (...args: any) => any>(f: F): ThisFunction<F> {
return function (this: FirstParameter<F>, ...b: SkipFirstParameter<F>) {
return f(this, ...b)
}
}

@@ -5,1 +5,3 @@ export * from "./error"

export * from "./raise"
export * from "./collections"
export * from "./objects"
export function undefinedIfNaN(n: number): number | undefined {
if (isNaN(n)) {
return undefined
}
if (isNaN(n)) {
return undefined
}
return n
return n
}
export function parseIntOrUndefined(
s: string,
radix?: number
s: string,
radix?: number
): number | undefined {
return undefinedIfNaN(parseInt(s, radix))
return undefinedIfNaN(parseInt(s, radix))
}
export function parseFloatOrUndefined(s: string): number | undefined {
return undefinedIfNaN(parseFloat(s))
return undefinedIfNaN(parseFloat(s))
}

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

export function raise(error: Error): never {
throw error
throw error
}

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

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