Skip to content

Commit

Permalink
fix: test + update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
izatop committed Aug 30, 2023
1 parent 8eb5e57 commit c2f46e5
Show file tree
Hide file tree
Showing 36 changed files with 206 additions and 221 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@types/jest": "^29.5.4",
"@types/node": "^20.5.6",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"@types/node": "^20.5.7",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-unused-imports": "^3.0.0",
"jest": "^29.6.4",
"lerna": "^7.1.5",
"lerna": "^7.2.0",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/fs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@bunt/unit": "^0.29.13",
"@types/minio": "^7.1.1",
"@types/node-fetch": "^2.6.4",
"minio": "^7.1.1",
"minio": "^7.1.2",
"node-fetch": "2.7.0"
},
"license": "MIT"
Expand Down
4 changes: 1 addition & 3 deletions packages/is/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export const isNumber = (value: unknown): value is number => {
};

export const isNullish = (value: unknown): value is null | undefined => isNull(value) || isUndefined(value);
export const isNotNullish = <T>(value: T | null | undefined): value is null | undefined => (
!(isNull(value) || isUndefined(value))
);
export const isNotNullish = <T>(value: T | null | undefined): value is T => !isNullish(value);

export const isFunction = <T extends (...args: any) => any>(value: unknown): value is T => {
return typeof value === "function" && !isClass(value);
Expand Down
16 changes: 15 additions & 1 deletion packages/is/test/src/is.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {
isArray,
isArrowFunction,
isBoolean,
isNotNullish,
isNullish,
isClass,
isDefined,
isFunction,
Expand All @@ -23,7 +25,7 @@ describe("is", () => {
const objectValue = {};
const NaNValue = NaN;
const undefinedValue = undefined;
const functionValue = function test() {return null;};
const functionValue = function test(): null {return null;};
const arrowFunctionValue = () => void 0;
const stringValue = "hello";
const booleanValue1 = true;
Expand Down Expand Up @@ -86,6 +88,18 @@ describe("is", () => {
},
);

test.each(make((v) => isNull(v) || isUndefined(v)))(
"isNullish(%s): %s", (a, b) => {
expect(isNullish(a)).toBe(b);
},
);

test.each(make((v) => !isNullish(v)))(
"isNotNullish(%s): %s", (a, b) => {
expect(isNotNullish(a)).toBe(b);
},
);

test.each(make((v) => v === stringValue))(
"isString(%s): %s", (a, b) => {
expect(isString(a)).toBe(b);
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Async/AsyncCallback.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {bind} from "../decorator.js";
import {Promisify, Fn} from "../interfaces.js";
import {isUndefined} from "../is.js";
import {isUndefined} from "@bunt/is";

/**
* @deprecated use @bunt/async AsyncIteratorFactory
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Async/AsyncState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isDefined} from "../is.js";
import {isDefined} from "@bunt/is";

export interface IAsyncStateMap<T> {
resolve: (value: T | PromiseLike<T>) => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Exception/AssertionError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isFunction} from "../is.js";
import {isFunction} from "@bunt/is";
import {ILogable} from "../Logger/index.js";
import {ValidationError} from "./ValidationError.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Logger/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as os from "os";
import {format} from "util";
import {assert} from "../assert.js";
import {isDefined, isFunction, isInstanceOf, isNumber, isUndefined} from "../is.js";
import {isDefined, isFunction, isInstanceOf, isNumber, isUndefined} from "@bunt/is";
import {Perf} from "../Perf/index.js";
import {makeSafe} from "../function.js";
import {Promisify} from "../interfaces.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Logger/Transport/formatters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isDefined, isString} from "../../is.js";
import {isDefined, isString} from "@bunt/is";
import {LogFormat, LogMessage, SeverityLevel} from "../interfaces.js";

export const defaultLogFormat: LogFormat<string> = (log) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Logger/functions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isObject} from "../is.js";
import {isObject} from "@bunt/is";
import {ILogable, ILogger, Logable, LoggerOwner} from "./interfaces.js";
import {Logger} from "./Logger.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Map/XMap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {assert} from "../assert.js";
import {isArray, isFunction} from "../is.js";
import {isArray, isFunction} from "@bunt/is";

export type XMapArrayFactory<K, V> = (value: V, index: number, array: V[]) => K;
export type XMapInitializer<K, V> = (key: K) => V;
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Node/Argv.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {assert} from "../assert.js";
import {isDefined, isNumber} from "../is.js";
import {isDefined, isNumber} from "@bunt/is";
import {entriesReverse} from "../object.js";

const OPTION_REGEX = /^--([a-z0-9_-]+)=(.+)$/i;
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Perf/Perf.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {performance} from "perf_hooks";
import {isString} from "../is.js";
import {isString} from "@bunt/is";
import {ILogable} from "../Logger/index.js";
import {IPerfValue, PerfLabel} from "./interfaces.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/Transform/TransformInput.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Promisify} from "../interfaces.js";
import {isArray, isFunction, isObject} from "../is.js";
import {isArray, isFunction, isObject} from "@bunt/is";
import {JSONInput, Transformable, TransformOut, TransformSchema} from "./interfaces.js";

export class TransformInput {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/assert.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AssertionError} from "./Exception/index.js";
import {isFunction, isInstanceOf, isString} from "./is.js";
import {isFunction, isInstanceOf, isString} from "@bunt/is";

export type AssertionDetailsAllowType = string | Record<any, any> | null | number;
export type AssertionDetails = (() => AssertionDetailsAllowType) | AssertionDetailsAllowType;
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {assert} from "./assert.js";
import {DecoratorTarget} from "./interfaces.js";
import {isFunction, isUndefined} from "./is.js";
import {isFunction, isUndefined} from "@bunt/is";

export function memoize(target: DecoratorTarget, key: string): PropertyDescriptor {
const descriptor = Reflect.getOwnPropertyDescriptor(target, key);
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/function.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isArray} from "./is.js";
import {isArray} from "@bunt/is";
import {Promisify} from "./interfaces.js";
import {all} from "./Async/fn.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from "./is.js";
export * from "@bunt/is";
export * from "./stream.js";
export * from "./assert.js";
export * from "./object.js";
Expand Down
50 changes: 0 additions & 50 deletions packages/util/src/is.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/util/src/object.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {DecoratorTarget} from "./interfaces.js";
import {isObject} from "./is.js";
import {isObject} from "@bunt/is";

export const freeze = <S extends {[key: string]: any}>(source: S): S => {
const target = Object.freeze(Object.assign(Object.create(null), source));
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/stream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Duplex, Readable, Stream, Transform, Writable} from "stream";
import {isObject} from "./is.js";
import {isObject} from "@bunt/is";

type IsStream = Readable | Writable | Duplex | Transform | Stream;

Expand Down
Loading

0 comments on commit c2f46e5

Please sign in to comment.