localvalue-ts
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -46,2 +46,3 @@ import { Kind2, URIS2 } from "fp-ts/HKT"; | ||
readonly getOrElse: <E, A>(f: Lazy<A>) => (fa: Kind2<F, E, A>) => A; | ||
readonly getOrElseW: <E, A, B>(f: Lazy<B>) => (fa: Kind2<F, E, A>) => A | B; | ||
} | ||
@@ -51,2 +52,3 @@ export declare const fold: <E, A, B>(onNone: () => B, onError: (e: E) => B, onValue: (a: A) => B) => (fa: LocalValue<E, A>) => B; | ||
export declare const getOrElse: <E, A>(defaultValue: Lazy<A>) => (lv: LocalValue<E, A>) => A; | ||
export declare const getOrElseW: <E, A, B>(defaultValue: Lazy<B>) => (lv: LocalValue<E, A>) => A | B; | ||
export declare const of: <A, E = never>(v: A) => LocalValue<E, A>; | ||
@@ -53,0 +55,0 @@ export declare const chain: <E, A, B>(f: (a: A) => LocalValue<E, B>) => (lv: LocalValue<E, A>) => LocalValue<E, B>; |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.localValue = exports.invalid = exports.valid = exports.absent = exports.isInvalid = exports.isValid = exports.isAbsent = exports.alt = exports.toEither = exports.toOption = exports.fromEither = exports.fromOption = exports.map = exports.chain = exports.of = exports.getOrElse = exports.fold2 = exports.fold = exports.URI = void 0; | ||
exports.localValue = exports.invalid = exports.valid = exports.absent = exports.isInvalid = exports.isValid = exports.isAbsent = exports.alt = exports.toEither = exports.toOption = exports.fromEither = exports.fromOption = exports.map = exports.chain = exports.of = exports.getOrElseW = exports.getOrElse = exports.fold2 = exports.fold = exports.URI = void 0; | ||
var O = __importStar(require("fp-ts/Option")); | ||
@@ -92,2 +92,9 @@ var E = __importStar(require("fp-ts/Either")); | ||
exports.getOrElse = getOrElse; | ||
var getOrElseW = function (defaultValue) { return function (lv) { | ||
if (exports.isAbsent(lv) || exports.isInvalid(lv)) { | ||
return defaultValue(); | ||
} | ||
return lv.value; | ||
}; }; | ||
exports.getOrElseW = getOrElseW; | ||
var of = function (v) { return exports.valid(v); }; | ||
@@ -151,2 +158,3 @@ exports.of = of; | ||
getOrElse: exports.getOrElse, | ||
getOrElseW: exports.getOrElseW, | ||
of: exports.of, | ||
@@ -153,0 +161,0 @@ ap: _ap, |
{ | ||
"name": "localvalue-ts", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "A small library to wrap browser's localstorage in a functional fashion.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
25272
448