Comparing version 2.12.0 to 2.12.1
@@ -1581,3 +1581,3 @@ /** | ||
* import * as S from 'fp-ts/string' | ||
* import { intercalate } from 'fp-ts/Array' | ||
* import { intercalate } from 'fp-ts/ReadonlyArray' | ||
* | ||
@@ -1584,0 +1584,0 @@ * assert.deepStrictEqual(intercalate(S.Monoid)('-')(['a', 'b', 'c']), 'a-b-c') |
@@ -1927,3 +1927,3 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
* import * as S from 'fp-ts/string' | ||
* import { intercalate } from 'fp-ts/Array' | ||
* import { intercalate } from 'fp-ts/ReadonlyArray' | ||
* | ||
@@ -1930,0 +1930,0 @@ * assert.deepStrictEqual(intercalate(S.Monoid)('-')(['a', 'b', 'c']), 'a-b-c') |
@@ -731,3 +731,3 @@ /** | ||
/** | ||
* Alias of [`toReadonlyArray`](#toReadonlyArray). | ||
* Alias of [`toReadonlyArray`](#toreadonlyarray). | ||
* | ||
@@ -737,9 +737,9 @@ * @since 2.12.0 | ||
* @example | ||
* import { toEntries } from 'fp-ts/Record' | ||
* import { toEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
export declare const toEntries: <K extends string, A>(r: Readonly<Record<K, A>>) => readonly (readonly [K, A])[] | ||
/** | ||
* Converts an `Array` of `[key, value]` tuples into a `Record`. | ||
* Converts a `ReadonlyArray` of `[key, value]` tuples into a `ReadonlyRecord`. | ||
* | ||
@@ -749,3 +749,3 @@ * @since 2.12.0 | ||
* @example | ||
* import { fromEntries } from 'fp-ts/Record' | ||
* import { fromEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
@@ -752,0 +752,0 @@ * assert.deepStrictEqual(fromEntries([['a', 1], ['b', 2], ['a', 3]]), { b: 2, a: 3 }) |
@@ -1,2 +0,1 @@ | ||
import * as RA from './ReadonlyArray'; | ||
import { fromEquals } from './Eq'; | ||
@@ -6,3 +5,2 @@ import { flow, identity, pipe, SK } from './function'; | ||
import * as _ from './internal'; | ||
import * as Se from './Semigroup'; | ||
import { separated } from './Separated'; | ||
@@ -445,3 +443,3 @@ import * as S from './string'; | ||
/** | ||
* Alias of [`toReadonlyArray`](#toReadonlyArray). | ||
* Alias of [`toReadonlyArray`](#toreadonlyarray). | ||
* | ||
@@ -451,9 +449,9 @@ * @since 2.12.0 | ||
* @example | ||
* import { toEntries } from 'fp-ts/Record' | ||
* import { toEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
export var toEntries = toReadonlyArray; | ||
/** | ||
* Converts an `Array` of `[key, value]` tuples into a `Record`. | ||
* Converts a `ReadonlyArray` of `[key, value]` tuples into a `ReadonlyRecord`. | ||
* | ||
@@ -463,3 +461,3 @@ * @since 2.12.0 | ||
* @example | ||
* import { fromEntries } from 'fp-ts/Record' | ||
* import { fromEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
@@ -469,3 +467,8 @@ * assert.deepStrictEqual(fromEntries([['a', 1], ['b', 2], ['a', 3]]), { b: 2, a: 3 }) | ||
export var fromEntries = function (fa) { | ||
return fromFoldable(Se.last(), RA.Foldable)(fa); | ||
var out = {}; | ||
for (var _i = 0, fa_1 = fa; _i < fa_1.length; _i++) { | ||
var a = fa_1[_i]; | ||
out[a[0]] = a[1]; | ||
} | ||
return out; | ||
}; | ||
@@ -727,4 +730,4 @@ export function every(predicate) { | ||
fr = F.ap(F.map(fr, function (r) { return function (b) { | ||
r[key] = b; | ||
return r; | ||
var _a; | ||
return Object.assign({}, r, (_a = {}, _a[key] = b, _a)); | ||
}; }), f(key, ta[key])); | ||
@@ -731,0 +734,0 @@ }; |
@@ -635,3 +635,3 @@ /** | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
@@ -638,0 +638,0 @@ export declare const toEntries: <K extends string, A>(r: Record<K, A>) => [K, A][] |
@@ -367,3 +367,3 @@ var __assign = (this && this.__assign) || function () { | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
@@ -370,0 +370,0 @@ export var toEntries = toArray; |
@@ -1581,3 +1581,3 @@ /** | ||
* import * as S from 'fp-ts/string' | ||
* import { intercalate } from 'fp-ts/Array' | ||
* import { intercalate } from 'fp-ts/ReadonlyArray' | ||
* | ||
@@ -1584,0 +1584,0 @@ * assert.deepStrictEqual(intercalate(S.Monoid)('-')(['a', 'b', 'c']), 'a-b-c') |
@@ -731,3 +731,3 @@ /** | ||
/** | ||
* Alias of [`toReadonlyArray`](#toReadonlyArray). | ||
* Alias of [`toReadonlyArray`](#toreadonlyarray). | ||
* | ||
@@ -737,9 +737,9 @@ * @since 2.12.0 | ||
* @example | ||
* import { toEntries } from 'fp-ts/Record' | ||
* import { toEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
export declare const toEntries: <K extends string, A>(r: Readonly<Record<K, A>>) => readonly (readonly [K, A])[] | ||
/** | ||
* Converts an `Array` of `[key, value]` tuples into a `Record`. | ||
* Converts a `ReadonlyArray` of `[key, value]` tuples into a `ReadonlyRecord`. | ||
* | ||
@@ -749,3 +749,3 @@ * @since 2.12.0 | ||
* @example | ||
* import { fromEntries } from 'fp-ts/Record' | ||
* import { fromEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
@@ -752,0 +752,0 @@ * assert.deepStrictEqual(fromEntries([['a', 1], ['b', 2], ['a', 3]]), { b: 2, a: 3 }) |
@@ -24,3 +24,2 @@ "use strict"; | ||
exports.readonlyRecord = exports.hasOwnProperty = exports.insertAt = exports.Witherable = exports.TraversableWithIndex = exports.Traversable = exports.FoldableWithIndex = exports.Foldable = exports.getDifferenceMagma = exports.getIntersectionSemigroup = exports.getUnionMonoid = exports.getUnionSemigroup = exports.getWitherable = exports.getTraversableWithIndex = exports.getTraversable = exports.FilterableWithIndex = exports.Filterable = exports.Compactable = exports.getFoldableWithIndex = exports.getFoldable = exports.FunctorWithIndex = exports.flap = exports.Functor = exports.getMonoid = exports.getEq = exports.getShow = exports.URI = exports.separate = exports.compact = exports.reduceRight = exports.foldMap = exports.reduce = exports.partitionMap = exports.partition = exports.filterMap = exports.filter = exports._sequence = exports._traverse = exports._filterWithIndex = exports._filterMapWithIndex = exports._partitionWithIndex = exports._partitionMapWithIndex = exports._reduceRightWithIndex = exports._foldMapWithIndex = exports._reduceWithIndex = exports._partitionMap = void 0; | ||
var RA = __importStar(require("./ReadonlyArray")); | ||
var Eq_1 = require("./Eq"); | ||
@@ -30,3 +29,2 @@ var function_1 = require("./function"); | ||
var _ = __importStar(require("./internal")); | ||
var Se = __importStar(require("./Semigroup")); | ||
var Separated_1 = require("./Separated"); | ||
@@ -500,3 +498,3 @@ var S = __importStar(require("./string")); | ||
/** | ||
* Alias of [`toReadonlyArray`](#toReadonlyArray). | ||
* Alias of [`toReadonlyArray`](#toreadonlyarray). | ||
* | ||
@@ -506,9 +504,9 @@ * @since 2.12.0 | ||
* @example | ||
* import { toEntries } from 'fp-ts/Record' | ||
* import { toEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
exports.toEntries = exports.toReadonlyArray; | ||
/** | ||
* Converts an `Array` of `[key, value]` tuples into a `Record`. | ||
* Converts a `ReadonlyArray` of `[key, value]` tuples into a `ReadonlyRecord`. | ||
* | ||
@@ -518,3 +516,3 @@ * @since 2.12.0 | ||
* @example | ||
* import { fromEntries } from 'fp-ts/Record' | ||
* import { fromEntries } from 'fp-ts/ReadonlyRecord' | ||
* | ||
@@ -524,3 +522,8 @@ * assert.deepStrictEqual(fromEntries([['a', 1], ['b', 2], ['a', 3]]), { b: 2, a: 3 }) | ||
var fromEntries = function (fa) { | ||
return fromFoldable(Se.last(), RA.Foldable)(fa); | ||
var out = {}; | ||
for (var _i = 0, fa_1 = fa; _i < fa_1.length; _i++) { | ||
var a = fa_1[_i]; | ||
out[a[0]] = a[1]; | ||
} | ||
return out; | ||
}; | ||
@@ -807,4 +810,4 @@ exports.fromEntries = fromEntries; | ||
fr = F.ap(F.map(fr, function (r) { return function (b) { | ||
r[key] = b; | ||
return r; | ||
var _a; | ||
return Object.assign({}, r, (_a = {}, _a[key] = b, _a)); | ||
}; }), f(key, ta[key])); | ||
@@ -811,0 +814,0 @@ }; |
@@ -635,3 +635,3 @@ /** | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
@@ -638,0 +638,0 @@ export declare const toEntries: <K extends string, A>(r: Record<K, A>) => [K, A][] |
@@ -407,3 +407,3 @@ "use strict"; | ||
* | ||
* assert.deepStrictEqual(toEntries({ a: 1, b: 2 }), [['a', 1], ['b', 2]]) | ||
* assert.deepStrictEqual(toEntries({ b: 2, a: 1 }), [['a', 1], ['b', 2]]) | ||
*/ | ||
@@ -410,0 +410,0 @@ exports.toEntries = exports.toArray; |
{ | ||
"name": "fp-ts", | ||
"version": "2.12.0", | ||
"version": "2.12.1", | ||
"description": "Functional programming in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
4186103
138513