Comparing version 0.13.2 to 0.14.0-beta.0
"use strict"; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,6 +20,40 @@ var Maybe_1 = require("./Maybe"); | ||
lefts: function (list) { | ||
return list.filter(function (x) { return x.isLeft(); }).map(function (x) { return x.__value; }); | ||
var e_1, _a; | ||
var result = []; | ||
try { | ||
for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) { | ||
var x = list_1_1.value; | ||
if (x.isLeft()) { | ||
result.push(x.extract()); | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return result; | ||
}, | ||
rights: function (list) { | ||
return list.filter(function (x) { return x.isRight(); }).map(function (x) { return x.__value; }); | ||
var e_2, _a; | ||
var result = []; | ||
try { | ||
for (var list_2 = __values(list), list_2_1 = list_2.next(); !list_2_1.done; list_2_1 = list_2.next()) { | ||
var x = list_2_1.value; | ||
if (x.isRight()) { | ||
result.push(x.extract()); | ||
} | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (list_2_1 && !list_2_1.done && (_a = list_2.return)) _a.call(list_2); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
return result; | ||
}, | ||
@@ -15,0 +60,0 @@ encase: function (throwsF) { |
@@ -98,39 +98,2 @@ import { Either } from './Either'; | ||
export declare const Maybe: MaybeTypeRef; | ||
declare class Just<T> implements Maybe<T> { | ||
__value: T; | ||
constructor(value: T); | ||
isJust(): boolean; | ||
isNothing(): boolean; | ||
inspect(): string; | ||
toString(): string; | ||
toJSON(): T; | ||
equals(other: Maybe<T>): boolean; | ||
map<U>(f: (value: T) => U): Maybe<U>; | ||
ap<U>(maybeF: Maybe<(value: T) => U>): Maybe<U>; | ||
alt(_: Maybe<T>): Maybe<T>; | ||
chain<U>(f: (value: T) => Maybe<U>): Maybe<U>; | ||
chainNullable<U>(f: (value: T) => U | undefined | null | void): Maybe<U>; | ||
join<U>(this: Maybe<Maybe<U>>): Maybe<U>; | ||
reduce<U>(reducer: (accumulator: U, value: T) => U, initialValue: U): U; | ||
extend<U>(f: (value: Maybe<T>) => U): Maybe<U>; | ||
unsafeCoerce(): T; | ||
caseOf<U>(patterns: MaybePatterns<T, U>): U; | ||
orDefault(_: T): T; | ||
orDefaultLazy(_: () => T): T; | ||
toList(): T[]; | ||
mapOrDefault<U>(f: (value: T) => U, _: U): U; | ||
extract(): this extends AlwaysJust ? T : ExtractMaybe<T, undefined>; | ||
extractNullable(): this extends AlwaysJust ? T : ExtractMaybe<T, null>; | ||
toEither<L>(_: L): Either<L, T>; | ||
ifJust(effect: (value: T) => any): this; | ||
ifNothing(_: () => any): this; | ||
filter(pred: (value: T) => boolean): Maybe<T>; | ||
'fantasy-land/equals'(other: Maybe<T>): boolean; | ||
'fantasy-land/map'<U>(f: (value: T) => U): Maybe<U>; | ||
'fantasy-land/ap'<U>(maybeF: Maybe<(value: T) => U>): Maybe<U>; | ||
'fantasy-land/alt'(other: Maybe<T>): Maybe<T>; | ||
'fantasy-land/chain'<U>(f: (value: T) => Maybe<U>): Maybe<U>; | ||
'fantasy-land/reduce'<U>(reducer: (accumulator: U, value: T) => U, initialValue: U): U; | ||
'fantasy-land/extend'<U>(f: (value: Maybe<T>) => U): Maybe<U>; | ||
} | ||
declare class Nothing implements Maybe<never> { | ||
@@ -173,5 +136,5 @@ __value: never; | ||
/** Constructs a Just. Respents an optional value that exists. */ | ||
declare const just: <T>(value: T) => Just<T>; | ||
declare const just: <T>(value: T) => Maybe<T>; | ||
/** Represents a missing value, you can think of it as a smart 'null'. */ | ||
declare const nothing: Nothing; | ||
export { just as Just, nothing as Nothing }; |
{ | ||
"name": "purify-ts", | ||
"version": "0.13.2", | ||
"version": "0.14.0-beta.0", | ||
"description": "Functional programming standard library for TypeScript ", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "tsc && tsc -p tsconfig.es.json", | ||
"docs": "typedoc --out documentation/ src/ --theme minimal", | ||
@@ -33,6 +33,7 @@ "test": "jest", | ||
"jest": "^24.1.0", | ||
"prettier": "^1.19.1", | ||
"ts-jest": "^24.0.0", | ||
"typescript": "3.6.3" | ||
"typescript": "3.7.3" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -8,2 +8,3 @@ <h3 align="center"> | ||
<img src="https://travis-ci.org/gigobyte/purify.svg?branch=master" alt="Build Status"> | ||
<img src="https://camo.githubusercontent.com/41c68e9f29c6caccc084e5a147e0abd5f392d9bc/68747470733a2f2f62616467656e2e6e65742f62616467652f547970655363726970742f7374726963742532302546302539462539322541412f626c7565" alt="Built with Typescript"> | ||
</a> | ||
@@ -49,2 +50,1 @@ </p> | ||
- [fp-ts - Functional programming in TypeScript](https://github.com/gcanti/fp-ts) | ||
- [typical - playground for type-level primitives in TypeScript](https://github.com/tycho01/typical/) |
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
39
3492
156533
5