Comparing version 0.0.3 to 0.0.5
@@ -1,2 +0,2 @@ | ||
/// <reference path="../maybe.d.ts" /> | ||
import type { Just, Nothing } from "../@types/easy-maybe/maybe.d"; | ||
export declare enum MaybeType { | ||
@@ -3,0 +3,0 @@ Just = "maybe-just", |
"use strict"; | ||
/// <reference path="../maybe.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -21,1 +20,2 @@ exports.JustImpl = exports.NothingImpl = exports.plunge = exports.MaybeType = void 0; | ||
exports.JustImpl = JustImpl; | ||
//# sourceMappingURL=common.js.map |
@@ -1,2 +0,2 @@ | ||
/// <reference path="../maybe.d.ts" /> | ||
import type { Maybe } from "../@types/easy-maybe/maybe.d"; | ||
export declare const Extra: { | ||
@@ -6,4 +6,6 @@ as: <A, B>(f: (arg0: Maybe<A>) => Maybe<B>, m: Maybe<A>) => Maybe<B>; | ||
combine2: <A_2, B_1>(m: [Maybe<A_2>, Maybe<B_1>]) => Maybe<[A_2, B_1]>; | ||
isJust: <T>(m: Maybe<T>) => boolean; | ||
isNothing: <T_1>(m: Maybe<T_1>) => boolean; | ||
fork: <T>(m: Maybe<T>) => T | undefined; | ||
forkJust: <T_1>(m: Maybe<T_1>) => T_1; | ||
isJust: <T_2>(m: Maybe<T_2>) => boolean; | ||
isNothing: <T_3>(m: Maybe<T_3>) => boolean; | ||
}; |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.Extra = void 0; | ||
/// <reference path="../maybe.d.ts" /> | ||
const maybe_1 = __importDefault(require("./maybe")); | ||
@@ -21,2 +20,22 @@ const common_1 = require("./common"); | ||
}; | ||
const fork = (m) => { | ||
switch (m.type) { | ||
case common_1.MaybeType.Just: { | ||
return m.value; | ||
} | ||
case common_1.MaybeType.Nothing: | ||
default: | ||
return undefined; | ||
} | ||
}; | ||
const forkJust = (m) => { | ||
switch (m.type) { | ||
case common_1.MaybeType.Just: { | ||
return m.value; | ||
} | ||
case common_1.MaybeType.Nothing: | ||
default: | ||
throw new Error('Nothing'); | ||
} | ||
}; | ||
const isJust = (m) => m.type === common_1.MaybeType.Just; | ||
@@ -53,4 +72,7 @@ const isNothing = (m) => m.type === common_1.MaybeType.Nothing; | ||
combine2, | ||
fork, | ||
forkJust, | ||
isJust, | ||
isNothing, | ||
}; | ||
//# sourceMappingURL=extra.js.map |
@@ -23,1 +23,2 @@ "use strict"; | ||
__exportStar(require("./extra"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
/// <reference path="../maybe.d.ts" /> | ||
import type { Maybe } from "../@types/easy-maybe/maybe.d"; | ||
declare const MaybeImpl: { | ||
@@ -8,4 +8,5 @@ andMap: <A, B>(f: (arg0: A) => B, m: Maybe<A>) => Maybe<B>; | ||
tap: <T_1>(f: (arg0: T_1) => void, m: Maybe<T_1>) => Maybe<T_1>; | ||
withDefault: <T_2>(defaultValue: T_2, m: Maybe<T_2>) => T_2; | ||
unwrap: <T_2>(m: Maybe<T_2>) => T_2 | undefined; | ||
withDefault: <T_3>(defaultValue: T_3, m: Maybe<T_3>) => T_3; | ||
}; | ||
export default MaybeImpl; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/// <reference path="../maybe.d.ts" /> | ||
const common_1 = require("./common"); | ||
@@ -51,2 +50,11 @@ const andMap = (f, m) => { | ||
}; | ||
const unwrap = (m) => { | ||
switch (m.type) { | ||
case common_1.MaybeType.Just: | ||
return m.value; | ||
case common_1.MaybeType.Nothing: | ||
default: | ||
return undefined; | ||
} | ||
}; | ||
const withDefault = (defaultValue, m) => { | ||
@@ -67,4 +75,6 @@ switch (m.type) { | ||
tap, | ||
unwrap, | ||
withDefault, | ||
}; | ||
exports.default = MaybeImpl; | ||
//# sourceMappingURL=maybe.js.map |
{ | ||
"name": "easy-maybe", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"description": "", | ||
"main": "lib/index.ts", | ||
"types": "maybe.d.ts", | ||
"types": "@types/easy-maybe/maybe.d.ts", | ||
"scripts": { | ||
"build": "rm -rf lib && tsc --outDir lib", | ||
"build": "rm -rf lib && tsc --outDir lib --sourceMap", | ||
"prepare": "npm run build", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "tsc --noEmit" | ||
}, | ||
@@ -12,0 +12,0 @@ "author": "", |
@@ -1,2 +0,2 @@ | ||
/// <reference path="../maybe.d.ts" /> | ||
import type { Just, Nothing } from "../@types/easy-maybe/maybe.d"; | ||
@@ -3,0 +3,0 @@ export enum MaybeType { |
@@ -1,2 +0,2 @@ | ||
/// <reference path="../maybe.d.ts" /> | ||
import type { Maybe } from "../@types/easy-maybe/maybe.d"; | ||
import MaybeImpl from './maybe'; | ||
@@ -16,2 +16,24 @@ import { JustImpl, NothingImpl, MaybeType, plunge } from './common'; | ||
const fork = <T>(m: Maybe<T>): T | undefined => { | ||
switch (m.type) { | ||
case MaybeType.Just: { | ||
return m.value; | ||
} | ||
case MaybeType.Nothing: | ||
default: | ||
return undefined; | ||
} | ||
}; | ||
const forkJust = <T>(m: Maybe<T>): T => { | ||
switch (m.type) { | ||
case MaybeType.Just: { | ||
return m.value; | ||
} | ||
case MaybeType.Nothing: | ||
default: | ||
throw new Error('Nothing') | ||
} | ||
}; | ||
const isJust = <T>(m: Maybe<T>): boolean => m.type === MaybeType.Just; | ||
@@ -53,4 +75,6 @@ | ||
combine2, | ||
fork, | ||
forkJust, | ||
isJust, | ||
isNothing, | ||
}; |
@@ -1,3 +0,3 @@ | ||
/// <reference path="../maybe.d.ts" /> | ||
import { JustImpl, MaybeType, NothingImpl, plunge } from './common'; | ||
import type { Maybe } from "../@types/easy-maybe/maybe.d"; | ||
import { JustImpl, MaybeType, NothingImpl } from './common'; | ||
@@ -55,2 +55,12 @@ const andMap = <A, B>(f: (arg0: A) => B, m: Maybe<A>): Maybe<B> => { | ||
const unwrap = <T>(m: Maybe<T>): T | undefined => { | ||
switch (m.type) { | ||
case MaybeType.Just: | ||
return m.value; | ||
case MaybeType.Nothing: | ||
default: | ||
return undefined; | ||
} | ||
} | ||
const withDefault = <T>(defaultValue: T, m: Maybe<T>): T => { | ||
@@ -72,2 +82,3 @@ switch (m.type) { | ||
tap, | ||
unwrap, | ||
withDefault, | ||
@@ -74,0 +85,0 @@ }; |
@@ -33,3 +33,3 @@ { | ||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ | ||
"typeRoots": ["./maybe.d.ts"], /* Specify multiple folders that act like `./node_modules/@types`. */ | ||
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ | ||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */ | ||
@@ -66,3 +66,3 @@ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ | ||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ | ||
"preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ | ||
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ | ||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */ | ||
@@ -103,5 +103,3 @@ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
] | ||
"include": ["src/**/*", "@types/**/*"] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
27808
21
486
2