immutable-lens
Advanced tools
Comparing version 0.4.1 to 0.4.2
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
@@ -10,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
@@ -10,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
{ | ||
"name": "immutable-lens", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Type-safe Lens API for immutable updates in complex data structures", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
"@types/chai": "^4.1.4", | ||
"@types/mocha": "^5.2.2", | ||
"@types/mocha": "^5.2.5", | ||
"chai": "^4.1.2", | ||
@@ -48,11 +48,11 @@ "chalk": "^2.4.1", | ||
"mocha": "^5.2.0", | ||
"prettier": "^1.13.5", | ||
"prettier": "^1.14.2", | ||
"ramda": "^0.25.0", | ||
"shx": "^0.3.0", | ||
"ts-node": "^6.1.1", | ||
"tslint": "^5.10.0", | ||
"tslint-config-prettier": "^1.13.0", | ||
"tslint-plugin-prettier": "^1.3.0", | ||
"typescript": "^2.9.2" | ||
"shx": "^0.3.2", | ||
"ts-node": "^7.0.1", | ||
"tslint": "^5.11.0", | ||
"tslint-config-prettier": "^1.15.0", | ||
"tslint-plugin-prettier": "^2.0.0", | ||
"typescript": "^3.0.3" | ||
} | ||
} |
@@ -35,11 +35,3 @@ import { expect } from 'chai' | ||
}) | ||
it('throws error when trying to update unknown field', () => { | ||
expect(() => | ||
recomposed.updatePartial(state => ({ | ||
unknown: state.user.firstName, | ||
}))(message), | ||
).to.throw('unknown') | ||
}) | ||
}) | ||
}) |
@@ -61,3 +61,3 @@ import { createLens } from '../src/createLens' | ||
// Updating object fields with wrong output type updaters @shouldNotCompile | ||
lens.updateFields({ todo: (value) => ({}) }) | ||
lens.updateFields({ todo: value => ({}) }) | ||
@@ -67,2 +67,5 @@ // Updating fields of array @shouldNotCompile | ||
// Passing function as fields object @shouldNotCompile | ||
lens.updateFields(() => '') | ||
///////////////////////// | ||
@@ -80,6 +83,6 @@ // Handling undefined // | ||
lens.updateFields({ | ||
user: (user) => { | ||
user: user => { | ||
const name = user.name | ||
return user | ||
} | ||
}, | ||
}) |
@@ -148,6 +148,2 @@ import { expect } from 'chai' | ||
it('throws error when passing function as fields object', () => { | ||
expect(() => lens.updateFields(() => '')(source)).to.throw() | ||
}) | ||
it('can set field value to undefined', () => { | ||
@@ -154,0 +150,0 @@ const updater = lens.focusPath('user').setValue(undefined) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
117831
2384