Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

localvalue-ts

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localvalue-ts - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

41

LocalValue.d.ts

@@ -48,13 +48,54 @@ import { Kind2, URIS2 } from "fp-ts/HKT";

}
/**
* fold none/error/value state and return a value accordingly none in case of absent, error in case of invalid value otherwise
*
* @category Destructors
*/
export declare const fold: <E, A, B>(onNone: () => B, onError: (e: E) => B, onValue: (a: A) => B) => (fa: LocalValue<E, A>) => B;
/**
* fold none/error/value state and return a value accordingly. Error in case of invalid or absent value otherwise
*
* @category Destructors
*/
export declare const fold2: <E, A, B>(onNotValid: (e?: E | undefined) => B, onValid: (a: A) => B) => (fa: LocalValue<E, A>) => B;
/**
* Extracts the value out of the structure, if it exists. Otherwise returns the given default value
*
* @category Destructors
*/
export declare const getOrElse: <E, A>(defaultValue: Lazy<A>) => (lv: LocalValue<E, A>) => A;
/**
* Return the value if is found and valid or a default value allow for different type in the default value
*
* @category Destructors
*/
export declare const getOrElseW: <E, A, B>(defaultValue: Lazy<B>) => (lv: LocalValue<E, A>) => A | B;
/**
* Wrap a value into the type constructor.
*
* @category Applicative
*/
export declare const of: <A, E = never>(v: A) => LocalValue<E, A>;
export declare const chain: <E, A, B>(f: (a: A) => LocalValue<E, B>) => (lv: LocalValue<E, A>) => LocalValue<E, B>;
/**
* @category Functor
*/
export declare const map: <E, A, B>(f: (a: A) => B) => (lv: LocalValue<E, A>) => LocalValue<E, B>;
/**
* Map none into absent and some into valid
*
* @category Functor
*/
export declare const fromOption: <A>(o: Option<A>) => LocalValue<never, A>;
/**
* Transforms an Either to a LocalValue wrapping error into an invalid.
*
* @category Constructors
*/
export declare const fromEither: <E, A>(e: Either<E, A>) => LocalValue<E, A>;
export declare const toOption: <E, A>(v: LocalValue<E, A>) => Option<A>;
export declare const toEither: <E, A>(onNone: Lazy<E>) => (v: LocalValue<E, A>) => Either<E, A>;
/**
* @category Alt
*/
export declare const alt: <E, A>(la: Lazy<LocalValue<E, A>>) => (lv: LocalValue<E, A>) => LocalValue<E, A>;

@@ -61,0 +102,0 @@ export declare const isAbsent: (lv: LocalValue<any, any>) => lv is Absent;

@@ -64,2 +64,7 @@ "use strict";

// -------------------------------------------------------------------------------------
/**
* fold none/error/value state and return a value accordingly none in case of absent, error in case of invalid value otherwise
*
* @category Destructors
*/
var fold = function (onNone, onError, onValue) { return function (fa) {

@@ -75,2 +80,7 @@ if (exports.isAbsent(fa)) {

exports.fold = fold;
/**
* fold none/error/value state and return a value accordingly. Error in case of invalid or absent value otherwise
*
* @category Destructors
*/
var fold2 = function (onNotValid, onValid) { return function (fa) {

@@ -86,2 +96,7 @@ if (exports.isAbsent(fa)) {

exports.fold2 = fold2;
/**
* Extracts the value out of the structure, if it exists. Otherwise returns the given default value
*
* @category Destructors
*/
var getOrElse = function (defaultValue) { return function (lv) {

@@ -94,2 +109,7 @@ if (exports.isAbsent(lv) || exports.isInvalid(lv)) {

exports.getOrElse = getOrElse;
/**
* Return the value if is found and valid or a default value allow for different type in the default value
*
* @category Destructors
*/
var getOrElseW = function (defaultValue) { return function (lv) {

@@ -102,2 +122,7 @@ if (exports.isAbsent(lv) || exports.isInvalid(lv)) {

exports.getOrElseW = getOrElseW;
/**
* Wrap a value into the type constructor.
*
* @category Applicative
*/
var of = function (v) { return exports.valid(v); };

@@ -109,2 +134,5 @@ exports.of = of;

exports.chain = chain;
/**
* @category Functor
*/
var map = function (f) { return function (lv) {

@@ -114,2 +142,7 @@ return _map(lv, f);

exports.map = map;
/**
* Map none into absent and some into valid
*
* @category Functor
*/
var fromOption = function (o) {

@@ -119,2 +152,7 @@ return pipeable_1.pipe(o, O.fold(function () { return exports.absent; }, function (v) { return exports.valid(v); }));

exports.fromOption = fromOption;
/**
* Transforms an Either to a LocalValue wrapping error into an invalid.
*
* @category Constructors
*/
var fromEither = function (e) {

@@ -132,2 +170,5 @@ return pipeable_1.pipe(e, E.fold(exports.invalid, function (v) { return exports.valid(v); }));

exports.toEither = toEither;
/**
* @category Alt
*/
var alt = function (la) { return function (lv) {

@@ -134,0 +175,0 @@ return _alt(lv, la);

2

package.json
{
"name": "localvalue-ts",
"version": "2.1.0",
"version": "2.1.1",
"description": "A small library to wrap browser's localstorage in a functional fashion.",

@@ -5,0 +5,0 @@ "main": "index.js",

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