Socket
Socket
Sign inDemoInstall

@nestia/e2e

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestia/e2e - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0-dev.20240709

76

lib/DynamicExecutor.d.ts

@@ -32,3 +32,3 @@ /**

*/
interface IOptions<Parameters extends any[], Ret = any> {
interface IProps<Parameters extends any[], Ret = any> {
/**

@@ -43,2 +43,6 @@ * Prefix of function name.

/**
* Location of the test functions.
*/
location: string;
/**
* Get parameters of a function.

@@ -51,2 +55,10 @@ *

/**
* On complete function.
*
* Listener of completion of a test function.
*
* @param exec Execution result of a test function
*/
onComplete?: (exec: IExecution) => void;
/**
* Filter function whether to run or not.

@@ -72,8 +84,2 @@ *

/**
* Whether to show elapsed time on `console` or not.
*
* @default true
*/
showElapsedTime?: boolean;
/**
* Extension of dynamic functions.

@@ -96,3 +102,3 @@ *

*/
executions: IReport.IExecution[];
executions: IExecution[];
/**

@@ -103,24 +109,26 @@ * Total elapsed time.

}
namespace IReport {
/**
* Execution of a test function.
*/
interface IExecution {
/**
* Execution result of a dynamic function.
* Name of function.
*/
interface IExecution {
/**
* Name of function.
*/
name: string;
/**
* Location path of the function.
*/
location: string;
/**
* Error when occured.
*/
error: Error | null;
/**
* Elapsed time.
*/
time: number;
}
name: string;
/**
* Location path of the function.
*/
location: string;
/**
* Error when occured.
*/
error: Error | null;
/**
* Elapsed time.
*/
started_at: string;
/**
* Completion time.
*/
completed_at: string;
}

@@ -134,6 +142,6 @@ /**

*
* @param options Options of dynamic executor
* @returns Runner of dynamic functions with specific location
* @param props Properties of dynamic execution
* @returns Report of dynamic test functions execution
*/
const assert: <Arguments extends any[]>(options: IOptions<Arguments>) => (path: string) => Promise<IReport>;
const assert: <Arguments extends any[]>(props: IProps<Arguments>) => Promise<IReport>;
/**

@@ -146,6 +154,6 @@ * Prepare dynamic executor in loose mode.

*
* @param options Options of dynamic executor
* @returns Runner of dynamic functions with specific location
* @param props Properties of dynamic executor
* @returns Report of dynamic test functions execution
*/
const validate: <Arguments extends any[]>(options: IOptions<Arguments>) => (path: string) => Promise<IReport>;
const validate: <Arguments extends any[]>(props: IProps<Arguments>) => Promise<IReport>;
}

@@ -102,6 +102,4 @@ "use strict";

exports.DynamicExecutor = void 0;
var chalk_1 = __importDefault(require("chalk"));
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
var StopWatch_1 = require("./StopWatch");
/**

@@ -135,15 +133,6 @@ * Dynamic Executor running prefixed functions.

*
* @param options Options of dynamic executor
* @returns Runner of dynamic functions with specific location
* @param props Properties of dynamic execution
* @returns Report of dynamic test functions execution
*/
DynamicExecutor.assert = function (options) {
/**
* Run dynamic executor.
*
* @param path Location of prefixed functions
*/
return function (path) {
return main(options)(true)(path);
};
};
DynamicExecutor.assert = function (props) { return main(true)(props); };
/**

@@ -156,41 +145,29 @@ * Prepare dynamic executor in loose mode.

*
* @param options Options of dynamic executor
* @returns Runner of dynamic functions with specific location
* @param props Properties of dynamic executor
* @returns Report of dynamic test functions execution
*/
DynamicExecutor.validate = function (options) {
/**
* Run dynamic executor.
*
* @param path Location of prefix functions
* @returns List of errors
*/
return function (path) {
return main(options)(false)(path);
};
DynamicExecutor.validate = function (props) { return main(false)(props); };
var main = function (assert) {
return function (props) { return __awaiter(_this, void 0, void 0, function () {
var report, executor, iterator;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
report = {
location: props.location,
time: Date.now(),
executions: [],
};
executor = execute(props)(report)(assert);
iterator = iterate((_a = props.extension) !== null && _a !== void 0 ? _a : "js")(executor);
return [4 /*yield*/, iterator(props.location)];
case 1:
_b.sent();
report.time = Date.now() - report.time;
return [2 /*return*/, report];
}
});
}); };
};
var main = function (options) {
return function (assert) {
return function (path) { return __awaiter(_this, void 0, void 0, function () {
var report, executor, iterator;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
report = {
location: path,
time: Date.now(),
executions: [],
};
executor = execute(options)(report)(assert);
iterator = iterate((_a = options.extension) !== null && _a !== void 0 ? _a : "js")(executor);
return [4 /*yield*/, iterator(path)];
case 1:
_b.sent();
report.time = Date.now() - report.time;
return [2 /*return*/, report];
}
});
}); };
};
};
var iterate = function (extension) {

@@ -255,3 +232,3 @@ return function (executor) {

};
var execute = function (options) {
var execute = function (props) {
return function (report) {

@@ -267,9 +244,9 @@ return function (assert) {

_loop_1 = function (key, closure) {
var func, label, result, _f, exp_1;
return __generator(this, function (_g) {
switch (_g.label) {
var func, result, exp_1;
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
if (key.substring(0, options.prefix.length) !== options.prefix ||
if (key.substring(0, props.prefix.length) !== props.prefix ||
typeof closure !== "function" ||
(options.filter && options.filter(key) === false))
(props.filter && props.filter(key) === false))
return [2 /*return*/, "continue"];

@@ -280,8 +257,8 @@ func = function () { return __awaiter(_this, void 0, void 0, function () {

case 0:
if (!(options.wrapper !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, options.wrapper(key, closure, options.parameters(key))];
if (!(props.wrapper !== undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, props.wrapper(key, closure, props.parameters(key))];
case 1:
_a.sent();
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, closure.apply(void 0, __spreadArray([], __read(options.parameters(key)), false))];
case 2: return [4 /*yield*/, closure.apply(void 0, __spreadArray([], __read(props.parameters(key)), false))];
case 3:

@@ -294,3 +271,2 @@ _a.sent();

}); };
label = chalk_1.default.greenBright(key);
result = {

@@ -300,32 +276,26 @@ name: key,

error: null,
time: Date.now(),
started_at: new Date().toISOString(),
completed_at: new Date().toISOString(),
};
report.executions.push(result);
_g.label = 1;
_f.label = 1;
case 1:
_g.trys.push([1, 6, , 7]);
if (!(options.showElapsedTime === false)) return [3 /*break*/, 3];
_f.trys.push([1, 3, 4, 5]);
return [4 /*yield*/, func()];
case 2:
_g.sent();
result.time = Date.now() - result.time;
console.log(" - ".concat(label));
_f.sent();
result.completed_at = new Date().toISOString();
return [3 /*break*/, 5];
case 3:
_f = result;
return [4 /*yield*/, StopWatch_1.StopWatch.measure(func)];
case 4:
_f.time = (_g.sent())[1];
console.log(" - ".concat(label, ": ").concat(chalk_1.default.yellowBright(result.time.toLocaleString()), " ms"));
_g.label = 5;
case 5: return [3 /*break*/, 7];
case 6:
exp_1 = _g.sent();
result.time = Date.now() - result.time;
exp_1 = _f.sent();
result.error = exp_1;
console.log(" - ".concat(label, " -> ").concat(chalk_1.default.redBright(exp_1 === null || exp_1 === void 0 ? void 0 : exp_1.name)));
if (assert === true)
throw exp_1;
return [3 /*break*/, 7];
case 7: return [2 /*return*/];
return [3 /*break*/, 5];
case 4:
result.completed_at = new Date().toISOString();
if (props.onComplete)
props.onComplete(result);
return [7 /*endfinally*/];
case 5: return [2 /*return*/];
}

@@ -332,0 +302,0 @@ });

@@ -61,9 +61,5 @@ "use strict";

};
function compare(x, y) {
return x.localeCompare(y);
}
function wrap(elem) {
return Array.isArray(elem) ? elem : [elem];
}
var compare = function (x, y) { return x.localeCompare(y); };
var wrap = function (elem) { return (Array.isArray(elem) ? elem : [elem]); };
})(GaffComparator || (exports.GaffComparator = GaffComparator = {}));
//# sourceMappingURL=GaffComparator.js.map
export * from "./ArrayUtil";
export * from "./DynamicBenchmarker";
export * from "./DynamicExecutor";
export * from "./GaffComparator";
export * from "./RandomGenerator";
export * from "./StopWatch";
export * from "./TestValidator";

@@ -18,8 +18,6 @@ "use strict";

__exportStar(require("./ArrayUtil"), exports);
__exportStar(require("./DynamicBenchmarker"), exports);
__exportStar(require("./DynamicExecutor"), exports);
__exportStar(require("./GaffComparator"), exports);
__exportStar(require("./RandomGenerator"), exports);
__exportStar(require("./StopWatch"), exports);
__exportStar(require("./TestValidator"), exports);
//# sourceMappingURL=module.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RandomGenerator = void 0;
var tstl_1 = require("tstl");
var tstl_2 = require("tstl");
/**

@@ -27,3 +25,3 @@ * Random data generator.

.fill("")
.map(function () { return CHARACTERS[(0, tstl_1.randint)(0, CHARACTERS.length - 1)]; })
.map(function () { return CHARACTERS[randint(0, CHARACTERS.length - 1)]; })
.join("");

@@ -42,3 +40,3 @@ };

.fill("")
.map(function () { return LETTERS[(0, tstl_1.randint)(0, LETTERS.length - 1)]; })
.map(function () { return LETTERS[randint(0, LETTERS.length - 1)]; })
.join("");

@@ -53,3 +51,3 @@ };

RandomGenerator.name = function (length) {
if (length === void 0) { length = (0, tstl_1.randint)(2, 3); }
if (length === void 0) { length = randint(2, 3); }
return RandomGenerator.paragraph(length)();

@@ -64,3 +62,3 @@ };

RandomGenerator.paragraph = function (sentences) {
if (sentences === void 0) { sentences = (0, tstl_1.randint)(2, 5); }
if (sentences === void 0) { sentences = randint(2, 5); }
/**

@@ -76,3 +74,3 @@ * @param wordMin Minimum number of characters in a sentence

.fill("")
.map(function () { return RandomGenerator.alphabets((0, tstl_1.randint)(wordMin, wordMax)); })
.map(function () { return RandomGenerator.alphabets(randint(wordMin, wordMax)); })
.join(" ");

@@ -88,3 +86,3 @@ };

RandomGenerator.content = function (paragraphes) {
if (paragraphes === void 0) { paragraphes = (0, tstl_1.randint)(3, 8); }
if (paragraphes === void 0) { paragraphes = randint(3, 8); }
/**

@@ -109,3 +107,3 @@ * @param sentenceMin Minimum number of sentences in a paragraph

.map(function () {
return RandomGenerator.paragraph((0, tstl_1.randint)(sentenceMin, sentenceMax))(wordMin, wordMax);
return RandomGenerator.paragraph(randint(sentenceMin, sentenceMax))(wordMin, wordMax);
})

@@ -123,4 +121,4 @@ .join("\n\n");

RandomGenerator.substring = function (content) {
var first = (0, tstl_1.randint)(0, content.length - 1);
var last = (0, tstl_1.randint)(first + 1, content.length);
var first = randint(0, content.length - 1);
var last = randint(first + 1, content.length);
return content.substring(first, last).trim();

@@ -140,6 +138,6 @@ };

(function () {
var value = (0, tstl_1.randint)(0, 9999);
var value = randint(0, 9999);
return value.toString().padStart(value < 1000 ? 3 : 4, "0");
})(),
(0, tstl_1.randint)(0, 9999).toString().padStart(4, "0"),
randint(0, 9999).toString().padStart(4, "0"),
].join("");

@@ -156,3 +154,3 @@ };

return function (range) {
return new Date(from.getTime() + (0, tstl_1.randint)(0, range));
return new Date(from.getTime() + randint(0, range));
};

@@ -169,5 +167,7 @@ };

return function (count) {
var ret = [];
tstl_2.ranges.sample(array, (0, tstl_1.back_inserter)(ret), count);
return ret;
count = Math.min(count, array.length);
var indexes = new Set();
while (indexes.size < count)
indexes.add(randint(0, array.length - 1));
return Array.from(indexes).map(function (index) { return array[index]; });
};

@@ -181,4 +181,7 @@ };

*/
RandomGenerator.pick = function (array) { return array[(0, tstl_1.randint)(0, array.length - 1)]; };
RandomGenerator.pick = function (array) { return array[randint(0, array.length - 1)]; };
})(RandomGenerator || (exports.RandomGenerator = RandomGenerator = {}));
var randint = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
//# sourceMappingURL=RandomGenerator.js.map

@@ -84,3 +84,3 @@ /**

*/
const sort: (title: string) => <T extends object, Fields extends string, Sortable extends (`-${Fields}` | `+${Fields}`)[] = (`-${Fields}` | `+${Fields}`)[]>(getter: (sortable: Sortable) => Promise<T[]>) => (...fields: Fields[]) => (comp: (x: T, y: T) => number, filter?: (elem: T) => boolean) => (direction: "+" | "-", trace?: boolean) => Promise<void>;
const sort: (title: string) => <T extends object, Fields extends string, Sortable extends Array<`-${Fields}` | `+${Fields}`> = (`-${Fields}` | `+${Fields}`)[]>(getter: (sortable: Sortable) => Promise<T[]>) => (...fields: Fields[]) => (comp: (x: T, y: T) => number, filter?: (elem: T) => boolean) => (direction: "+" | "-", trace?: boolean) => Promise<void>;
type Sortable<Literal extends string> = Array<`-${Literal}` | `+${Literal}`>;

@@ -87,0 +87,0 @@ }

@@ -76,3 +76,2 @@ "use strict";

exports.TestValidator = void 0;
var tstl_1 = require("tstl");
var RandomGenerator_1 = require("./RandomGenerator");

@@ -407,3 +406,3 @@ var json_equal_to_1 = require("./internal/json_equal_to");

reversed = direction === "+" ? comp : function (x, y) { return comp(y, x); };
if (tstl_1.ranges.is_sorted(data, function (x, y) { return reversed(x, y) < 0; }) === false) {
if (is_sorted(data, reversed) === false) {
if (fields.length === 1 &&

@@ -435,2 +434,8 @@ data.length &&

}
function is_sorted(data, comp) {
for (var i = 1; i < data.length; ++i)
if (comp(data[i - 1], data[i]) > 0)
return false;
return true;
}
//# sourceMappingURL=TestValidator.js.map
{
"name": "@nestia/e2e",
"version": "0.6.0",
"version": "0.7.0-dev.20240709",
"description": "E2E test utilify functions",
"main": "lib/index.js",
"scripts": {
"build": "rimraf lib && tsc",
"dev": "npm run build -- --watch",
"eslint": "eslint src",
"build": "npm run build:main && npm run build:test",
"build:main": "rimraf lib && tsc",
"build:test": "rimraf bin && tsc -p test/tsconfig.json",
"dev": "npm run build:test -- --watch",
"eslint": "eslint src && eslint test",
"prepare": "ts-patch install && typia patch",
"test": "node lib/test"
"test": "node bin/test"
},

@@ -33,3 +35,2 @@ "repository": {

"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/cli": "^0.11.21",
"@types/node": "^18.11.18",

@@ -40,18 +41,10 @@ "@typescript-eslint/eslint-plugin": "^5.57.0",

"ts-node": "^10.9.1",
"ts-patch": "^3.1.0",
"typescript": "^5.4.2",
"typia": "^6.1.1"
"ts-patch": "^3.2.1",
"typescript": "^5.5.3",
"typescript-transform-paths": "^3.4.7",
"typia": "^6.4.3"
},
"dependencies": {
"@nestia/fetcher": "^3.2.2",
"chalk": "^4.1.2",
"cli": "^1.0.1",
"tgrid": "^1.0.1",
"tstl": "^3.0.0"
},
"files": [
"lib",
"src",
"!lib/test",
"!src/test",
"README.md",

@@ -58,0 +51,0 @@ "LICENSE",

@@ -1,7 +0,4 @@

import chalk from "chalk";
import fs from "fs";
import NodePath from "path";
import { StopWatch } from "./StopWatch";
/**

@@ -39,3 +36,3 @@ * Dynamic Executor running prefixed functions.

*/
export interface IOptions<Parameters extends any[], Ret = any> {
export interface IProps<Parameters extends any[], Ret = any> {
/**

@@ -51,2 +48,7 @@ * Prefix of function name.

/**
* Location of the test functions.
*/
location: string;
/**
* Get parameters of a function.

@@ -60,2 +62,11 @@ *

/**
* On complete function.
*
* Listener of completion of a test function.
*
* @param exec Execution result of a test function
*/
onComplete?: (exec: IExecution) => void;
/**
* Filter function whether to run or not.

@@ -87,9 +98,2 @@ *

/**
* Whether to show elapsed time on `console` or not.
*
* @default true
*/
showElapsedTime?: boolean;
/**
* Extension of dynamic functions.

@@ -114,3 +118,3 @@ *

*/
executions: IReport.IExecution[];
executions: IExecution[];

@@ -122,27 +126,31 @@ /**

}
export namespace IReport {
/**
* Execution of a test function.
*/
export interface IExecution {
/**
* Execution result of a dynamic function.
* Name of function.
*/
export interface IExecution {
/**
* Name of function.
*/
name: string;
name: string;
/**
* Location path of the function.
*/
location: string;
/**
* Location path of the function.
*/
location: string;
/**
* Error when occured.
*/
error: Error | null;
/**
* Error when occured.
*/
error: Error | null;
/**
* Elapsed time.
*/
time: number;
}
/**
* Elapsed time.
*/
started_at: string;
/**
* Completion time.
*/
completed_at: string;
}

@@ -157,14 +165,8 @@

*
* @param options Options of dynamic executor
* @returns Runner of dynamic functions with specific location
* @param props Properties of dynamic execution
* @returns Report of dynamic test functions execution
*/
export const assert =
<Arguments extends any[]>(options: IOptions<Arguments>) =>
/**
* Run dynamic executor.
*
* @param path Location of prefixed functions
*/
(path: string): Promise<IReport> =>
main(options)(true)(path);
export const assert = <Arguments extends any[]>(
props: IProps<Arguments>,
): Promise<IReport> => main(true)(props);

@@ -178,22 +180,16 @@ /**

*
* @param options Options of dynamic executor
* @returns Runner of dynamic functions with specific location
* @param props Properties of dynamic executor
* @returns Report of dynamic test functions execution
*/
export const validate =
<Arguments extends any[]>(options: IOptions<Arguments>) =>
/**
* Run dynamic executor.
*
* @param path Location of prefix functions
* @returns List of errors
*/
(path: string): Promise<IReport> =>
main(options)(false)(path);
export const validate = <Arguments extends any[]>(
props: IProps<Arguments>,
): Promise<IReport> => main(false)(props);
const main =
<Arguments extends any[]>(options: IOptions<Arguments>) =>
(assert: boolean) =>
async (path: string) => {
async <Arguments extends any[]>(
props: IProps<Arguments>,
): Promise<IReport> => {
const report: IReport = {
location: path,
location: props.location,
time: Date.now(),

@@ -203,5 +199,5 @@ executions: [],

const executor = execute(options)(report)(assert);
const iterator = iterate(options.extension ?? "js")(executor);
await iterator(path);
const executor = execute(props)(report)(assert);
const iterator = iterate(props.extension ?? "js")(executor);
await iterator(props.location);

@@ -236,3 +232,3 @@ report.time = Date.now() - report.time;

const execute =
<Arguments extends any[]>(options: IOptions<Arguments>) =>
<Arguments extends any[]>(props: IProps<Arguments>) =>
(report: IReport) =>

@@ -243,5 +239,5 @@ (assert: boolean) =>

if (
key.substring(0, options.prefix.length) !== options.prefix ||
key.substring(0, props.prefix.length) !== props.prefix ||
typeof closure !== "function" ||
(options.filter && options.filter(key) === false)
(props.filter && props.filter(key) === false)
)

@@ -251,13 +247,13 @@ continue;

const func = async () => {
if (options.wrapper !== undefined)
await options.wrapper(key, closure, options.parameters(key));
else await closure(...options.parameters(key));
if (props.wrapper !== undefined)
await props.wrapper(key, closure, props.parameters(key));
else await closure(...props.parameters(key));
};
const label: string = chalk.greenBright(key);
const result: IReport.IExecution = {
const result: IExecution = {
name: key,
location,
error: null,
time: Date.now(),
started_at: new Date().toISOString(),
completed_at: new Date().toISOString(),
};

@@ -267,22 +263,10 @@ report.executions.push(result);

try {
if (options.showElapsedTime === false) {
await func();
result.time = Date.now() - result.time;
console.log(` - ${label}`);
} else {
result.time = (await StopWatch.measure(func))[1];
console.log(
` - ${label}: ${chalk.yellowBright(
result.time.toLocaleString(),
)} ms`,
);
}
await func();
result.completed_at = new Date().toISOString();
} catch (exp) {
result.time = Date.now() - result.time;
result.error = exp as Error;
console.log(
` - ${label} -> ${chalk.redBright((exp as Error)?.name)}`,
);
if (assert === true) throw exp;
} finally {
result.completed_at = new Date().toISOString();
if (props.onComplete) props.onComplete(result);
}

@@ -289,0 +273,0 @@ }

@@ -20,3 +20,3 @@ /**

<T>(getter: (input: T) => string | string[]) =>
(x: T, y: T) => {
(x: T, y: T): number => {
const a: string[] = wrap(getter(x));

@@ -37,3 +37,3 @@ const b: string[] = wrap(getter(y));

<T>(getter: (input: T) => string | string[]) =>
(x: T, y: T) => {
(x: T, y: T): number => {
const take = (v: T) =>

@@ -56,3 +56,3 @@ wrap(getter(v)).map((str) => new Date(str).getTime());

<T>(closure: (input: T) => number | number[]) =>
(x: T, y: T) => {
(x: T, y: T): number => {
const a: number[] = wrap(closure(x));

@@ -65,9 +65,4 @@ const b: number[] = wrap(closure(y));

function compare(x: string, y: string) {
return x.localeCompare(y);
}
function wrap<T>(elem: T | T[]): T[] {
return Array.isArray(elem) ? elem : [elem];
}
const compare = (x: string, y: string) => x.localeCompare(y);
const wrap = <T>(elem: T | T[]): T[] => (Array.isArray(elem) ? elem : [elem]);
}
export * from "./ArrayUtil";
export * from "./DynamicBenchmarker";
export * from "./DynamicExecutor";
export * from "./GaffComparator";
export * from "./RandomGenerator";
export * from "./StopWatch";
export * from "./TestValidator";

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

import { back_inserter, randint } from "tstl";
import { ranges } from "tstl";
/**

@@ -149,5 +146,6 @@ * Random data generator.

(count: number): T[] => {
const ret: T[] = [];
ranges.sample(array, back_inserter(ret), count);
return ret;
count = Math.min(count, array.length);
const indexes: Set<number> = new Set();
while (indexes.size < count) indexes.add(randint(0, array.length - 1));
return Array.from(indexes).map((index) => array[index]);
};

@@ -163,1 +161,4 @@

}
const randint = (min: number, max: number): number =>
Math.floor(Math.random() * (max - min + 1)) + min;

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

import { ranges } from "tstl";
import { RandomGenerator } from "./RandomGenerator";

@@ -307,3 +305,3 @@ import { json_equal_to } from "./internal/json_equal_to";

direction === "+" ? comp : (x, y) => comp(y, x);
if (ranges.is_sorted(data, (x, y) => reversed(x, y) < 0) === false) {
if (is_sorted(data, reversed) === false) {
if (

@@ -345,1 +343,7 @@ fields.length === 1 &&

}
function is_sorted<T>(data: T[], comp: (x: T, y: T) => number): boolean {
for (let i: number = 1; i < data.length; ++i)
if (comp(data[i - 1], data[i]) > 0) return false;
return true;
}

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