Comparing version 0.13.1 to 0.13.2
@@ -40,3 +40,3 @@ "use strict"; | ||
Right.prototype.inspect = function () { | ||
return "Right(" + this.__value + ")"; | ||
return "Right(" + JSON.stringify(this.__value) + ")"; | ||
}; | ||
@@ -153,3 +153,3 @@ Right.prototype.toString = function () { | ||
Left.prototype.inspect = function () { | ||
return "Left(" + this.__value + ")"; | ||
return "Left(" + JSON.stringify(this.__value) + ")"; | ||
}; | ||
@@ -156,0 +156,0 @@ Left.prototype.toString = function () { |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -8,0 +9,0 @@ }); |
@@ -18,7 +18,7 @@ import { Tuple } from './Tuple'; | ||
init: <T>(list: T[]) => Maybe<T[]>; | ||
uncons: <T>(list: T[]) => Maybe<Tuple<T, T[]>>; | ||
uncons: <T_1>(list: T_1[]) => Maybe<Tuple<T_1, T_1[]>>; | ||
at: typeof at; | ||
head: <T>(list: T[]) => Maybe<T>; | ||
last: <T>(list: T[]) => Maybe<T>; | ||
tail: <T>(list: T[]) => Maybe<T[]>; | ||
head: <T_2>(list: T_2[]) => Maybe<T_2>; | ||
last: <T_3>(list: T_3[]) => Maybe<T_3>; | ||
tail: <T_4>(list: T_4[]) => Maybe<T_4[]>; | ||
find: typeof find; | ||
@@ -25,0 +25,0 @@ findIndex: typeof findIndex; |
22
List.js
"use strict"; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -57,3 +77,3 @@ var Tuple_1 = require("./Tuple"); | ||
default: | ||
return list.slice().sort(function (x, y) { return Function_1.orderToNumber(compare(x, y)); }); | ||
return __spread(list).sort(function (x, y) { return Function_1.orderToNumber(compare(x, y)); }); | ||
} | ||
@@ -60,0 +80,0 @@ } |
@@ -11,2 +11,3 @@ import { Either } from './Either'; | ||
} | ||
declare type ExtractMaybe<T, TDefault> = T extends never ? TDefault : T | TDefault; | ||
export interface Maybe<T> { | ||
@@ -53,5 +54,5 @@ /** Internal property and subject to breaking changes, please use some of the available methods on the object if you want to access it */ | ||
/** Returns the value inside `this` or undefined if `this` is `Nothing`. Use `extractNullable` if you need a null returned instead */ | ||
extract(): this extends AlwaysJust ? T : T | undefined; | ||
extract(): this extends AlwaysJust ? T : ExtractMaybe<T, undefined>; | ||
/** Returns the value inside `this` or null if `this` is `Nothing`. Use `extract` if you need an undefined returned instead */ | ||
extractNullable(): this extends AlwaysJust ? T : T | null; | ||
extractNullable(): this extends AlwaysJust ? T : ExtractMaybe<T, null>; | ||
/** Constructs a `Right` from a `Just` or a `Left` with a provided left value if `this` is `Nothing` */ | ||
@@ -122,4 +123,4 @@ toEither<L>(left: L): Either<L, T>; | ||
mapOrDefault<U>(f: (value: T) => U, _: U): U; | ||
extract(): this extends AlwaysJust ? T : T | undefined; | ||
extractNullable(): this extends AlwaysJust ? T : T | null; | ||
extract(): this extends AlwaysJust ? T : ExtractMaybe<T, undefined>; | ||
extractNullable(): this extends AlwaysJust ? T : ExtractMaybe<T, null>; | ||
toEither<L>(_: L): Either<L, T>; | ||
@@ -159,4 +160,4 @@ ifJust(effect: (value: T) => any): this; | ||
mapOrDefault<U>(_: (value: never) => U, defaultValue: U): U; | ||
extract(): this extends AlwaysJust ? never : undefined; | ||
extractNullable(): this extends AlwaysJust ? never : null; | ||
extract(): this extends AlwaysJust ? never : ExtractMaybe<never, undefined>; | ||
extractNullable(): this extends AlwaysJust ? never : ExtractMaybe<never, null>; | ||
toEither<L, T>(left: L): Either<L, T>; | ||
@@ -163,0 +164,0 @@ ifJust(_: (value: never) => any): this; |
@@ -68,3 +68,3 @@ "use strict"; | ||
Just.prototype.inspect = function () { | ||
return "Just(" + this.__value + ")"; | ||
return "Just(" + JSON.stringify(this.__value) + ")"; | ||
}; | ||
@@ -71,0 +71,0 @@ Just.prototype.toString = function () { |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -8,0 +9,0 @@ }); |
{ | ||
"name": "purify-ts", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "Functional programming standard library for TypeScript ", | ||
@@ -33,5 +33,5 @@ "main": "lib/index.js", | ||
"ts-jest": "^24.0.0", | ||
"typescript": "3.5.3" | ||
"typescript": "3.6.3" | ||
}, | ||
"dependencies": {} | ||
} |
22
Tuple.js
@@ -29,2 +29,18 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -56,3 +72,3 @@ var TupleImpl = /** @class */ (function () { | ||
TupleImpl.prototype.inspect = function () { | ||
return "Tuple(" + this.first + ", " + this.second + ")"; | ||
return "Tuple(" + JSON.stringify(this.first) + ", " + JSON.stringify(this.second) + ")"; | ||
}; | ||
@@ -111,3 +127,3 @@ TupleImpl.prototype.toString = function () { | ||
fromArray: function (_a) { | ||
var fst = _a[0], snd = _a[1]; | ||
var _b = __read(_a, 2), fst = _b[0], snd = _b[1]; | ||
return exports.Tuple(fst, snd); | ||
@@ -120,3 +136,3 @@ }, | ||
} | ||
var f = args[0], g = args[1], value = args[2]; | ||
var _a = __read(args, 3), f = _a[0], g = _a[1], value = _a[2]; | ||
switch (args.length) { | ||
@@ -123,0 +139,0 @@ case 3: |
Sorry, the diff of this file is not supported yet
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
226393
1499