Socket
Socket
Sign inDemoInstall

@just-func/types

Package Overview
Dependencies
5
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.3 to 0.4.0

lib/validators.d.ts

1

lib/index.d.ts
export * from './Just';
export * from './toJustValue';
export * from './validators';
//# sourceMappingURL=index.d.ts.map

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

__exportStar(require("./toJustValue"), exports);
__exportStar(require("./validators"), exports);
//# sourceMappingURL=index.js.map

32

lib/Just.d.ts
import type { AnyFunction, Equal } from 'type-plus';
export declare type JustMeta = {
readonly error?: Error;
readonly [k: string | symbol]: any;
};
export declare type ErrorMeta = {
readonly error?: Error;
};
export declare type StackTraceMeta = {
ssf?: AnyFunction;
};
export declare type JustEmpty = readonly [];
export declare type JustUno<Value> = readonly [Value];
export declare type JustDuo<Value, Meta extends JustMeta> = readonly [Value, Meta];
export declare type JustValue<Value = undefined, Meta extends JustMeta | undefined = undefined> = (Meta extends JustMeta ? JustDuo<Value, Meta> : (Equal<Value, undefined> extends true ? JustEmpty : JustUno<Value>));
export declare type JustDuo<Value, Meta extends JustMeta = JustMeta> = readonly [Value, Meta];
export declare type JustValue<Value = void, Meta extends JustMeta | undefined = undefined> = (Meta extends JustMeta ? JustDuo<Value, Meta> : Equal<Value, void, JustEmpty, JustUno<Value>>);
export declare type ToJustValue<Value> = Value extends [infer V, infer M] ? readonly [V, M] : (Value extends [infer V] ? readonly [V] : Value);
export declare type JustValues = JustEmpty | JustUno<any> | JustDuo<any, JustMeta>;
export declare function justValue(): JustEmpty;
export declare function justValue<Value = void, Meta extends JustMeta | undefined = undefined>(value: JustValue<Value, Meta>): JustValue<Value, Meta>;
export declare type JustResult<Value = void, Meta extends JustMeta | undefined = undefined> = (Meta extends JustMeta ? JustDuo<Value, Meta> : (Value extends Array<any> ? JustUno<Value> : Value));
export declare function justValue<Value = undefined, Meta extends JustMeta | undefined = undefined>(value: JustValue<Value, Meta>): JustValue<Value, Meta>;
export declare type StackTraceMeta = {
ssf?: AnyFunction;
};
export declare type JustMetaParam = {
readonly [k: string | symbol]: any;
};
export declare type JustParams = [arg?: any, meta?: JustMetaParam];
export declare type JustReturnTypes = JustEmpty | JustUno<any> | JustDuo<any, JustMeta>;
export declare type JustFunction<Param extends JustParams = JustParams, R extends JustReturnTypes = JustEmpty> = (...args: Param) => (R extends [infer V, infer M] ? readonly [V, M] : (R extends [infer V] ? readonly [V] : R));
export declare function justFunction<Param extends JustParams, R extends JustEmpty>(fn: JustFunction<Param, R>): JustFunction<Param, readonly []>;
export declare function justFunction<Param extends JustParams, R extends JustUno<any>>(fn: JustFunction<Param, R>): JustFunction<Param, R extends JustUno<infer V> ? JustUno<V> : never>;
export declare function justFunction<Param extends JustParams, R extends JustDuo<any, JustMeta>>(fn: JustFunction<Param, R>): JustFunction<Param, R extends JustDuo<infer V, infer M> ? JustDuo<V, M> : never>;
export declare type JustFunction<Param extends JustValues = JustEmpty, R extends JustValues = JustEmpty> = (...args: Param) => ToJustValue<R>;
export declare function justFunction<Param extends JustValues, R extends JustEmpty>(fn: JustFunction<Param, R>): JustFunction<Param, readonly []>;
export declare function justFunction<Param extends JustValues, R extends JustUno<any>>(fn: JustFunction<Param, R>): JustFunction<Param, R extends JustUno<infer V> ? JustUno<V> : never>;
export declare function justFunction<Param extends JustValues, R extends JustDuo<any, JustMeta>>(fn: JustFunction<Param, R>): JustFunction<Param, R extends JustDuo<infer V, infer M> ? JustDuo<V, M> : never>;
//# sourceMappingURL=Just.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.justFunction = exports.justValue = void 0;
function justValue(value) {
return value;
}
function justValue(value) { return value ?? []; }
exports.justValue = justValue;

@@ -8,0 +6,0 @@ function justFunction(fn) {

import { JustDuo, JustEmpty, JustMeta, JustUno } from './Just';
export declare function toJustValue<V extends void | undefined | JustEmpty>(value: V, meta?: JustMeta): JustEmpty;
export declare function toJustValue<V extends JustUno<any>>(value: V, meta?: JustMeta): Readonly<V>;
export declare function toJustValue<V extends JustDuo<any, any>>(value: V, meta?: JustMeta): Readonly<V>;
export declare function toJustValue<V>(value: V, meta?: JustMeta): JustUno<V>;
export declare function toJustValue<V extends void | undefined | JustEmpty>(value?: V, meta?: JustMeta): JustEmpty;
export declare function toJustValue<V extends JustUno<any>>(value?: V, meta?: JustMeta): Readonly<V>;
export declare function toJustValue<V extends JustDuo<any, any>>(value?: V, meta?: JustMeta): Readonly<V>;
export declare function toJustValue<V>(value?: V, meta?: JustMeta): JustUno<V>;
//# sourceMappingURL=toJustValue.d.ts.map
{
"name": "@just-func/types",
"version": "0.3.3",
"version": "0.4.0",
"description": "Types for just-func code",

@@ -28,22 +28,2 @@ "keywords": [

],
"scripts": {
"build": "run-s ts:clean ts:build",
"build:watch": "run-s ts:clean ts:build:watch",
"clean": "rimraf .nyc_output .tsbuildinfo coverage cjs esm lib || true",
"coverage": "jest --coverage",
"depcheck": "depcheck",
"jest:test": "jest",
"jest:watch": "jest --watch",
"lint": "cross-env TIMING=1 eslint --ext=js,ts .",
"nuke": "run-s clean nuke:local",
"nuke:local": "rimraf node_modules || true",
"size": "size-limit",
"test": "run-p jest:test",
"ts:build": "tsc -p tsconfig.build.json",
"ts:build:watch": "tsc -p tsconfig.build.json --watch",
"ts:clean": "rimraf .tsbuildinfo || true",
"version": "changeset version && yarn install",
"verify": "npm-run-all -p build lint coverage depcheck -s size",
"watch": "run-p jest:watch"
},
"dependencies": {

@@ -72,3 +52,3 @@ "type-plus": "^4.9.0"

"jest-watch-typeahead": "2.2.0",
"npm-check-updates": "16.3.10",
"npm-check-updates": "16.3.11",
"npm-run-all": "4.1.5",

@@ -83,3 +63,22 @@ "rimraf": "3.0.2",

}
]
}
],
"scripts": {
"build": "run-s ts:clean ts:build",
"build:watch": "run-s ts:clean ts:build:watch",
"clean": "rimraf .nyc_output .tsbuildinfo coverage cjs esm lib",
"coverage": "jest --coverage",
"depcheck": "depcheck",
"jest:test": "jest",
"jest:watch": "jest --watch",
"lint": "cross-env TIMING=1 eslint --ext=js,ts .",
"nuke": "run-s clean nuke:local",
"nuke:local": "rimraf node_modules",
"size": "size-limit",
"test": "run-p jest:test",
"ts:build": "tsc -p tsconfig.build.json",
"ts:build:watch": "tsc -p tsconfig.build.json --watch",
"ts:clean": "rimraf .tsbuildinfo",
"verify": "npm-run-all -p build lint coverage depcheck -s size",
"watch": "run-p jest:watch"
}
}

@@ -19,2 +19,9 @@ # @just-func/types

## Type guards
- `isJustEmpty()`
- `isJustUno()`
- `isJustDuo()`
- `isJustValue()`
## Metadata

@@ -21,0 +28,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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc