Skip to content

Commit

Permalink
Code review change: split tassign into its own package.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seth Davenport committed Nov 7, 2016
1 parent b8c6a98 commit e93949d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/strongly-typed-reducers.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Instead, we've provided a type-corrected immutable assignment function, `tassign
that will catch this type of error:

```typescript
import { tassign } from 'ng2-redux';
import { tassign } from 'tassign';

export const barReducer: Reducer<IBar> = (state: IBar, action: Action<number | string>): IBar => {
switch(action.type) {
Expand Down
3 changes: 2 additions & 1 deletion examples/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
"core-js": "^2.3.0",
"ng2-redux": "^4.0.0-beta.7",
"redux": "^3.5.0",
"redux-logger": "^2.6.1",
"redux-localstorage": "^0.4.0",
"redux-logger": "^2.6.1",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.12",
"tassign": "^1.0.0",
"zone.js": "^0.6.21"
},
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions examples/counter/store/search.reducer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { tassign } from 'tassign';
import { SEARCH_ACTIONS } from '../actions/search.actions';

export interface ISearchState {
Expand All @@ -18,14 +19,14 @@ export function searchReducer(

switch (action.type) {
case SEARCH_ACTIONS.SEARCH:
return Object.assign({}, state, {
return tassign(state, {
onSearch: true,
keyword: action.payload,
total: state.total
});
case SEARCH_ACTIONS.SEARCH_RESULT:
let total = action.payload.total;
return Object.assign({}, state, {
return tassign(state, {
onSearch: state.onSearch,
keyword: state.keyword,
total
Expand Down
52 changes: 0 additions & 52 deletions src/utils/tassign.spec.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/utils/tassign.ts

This file was deleted.

0 comments on commit e93949d

Please sign in to comment.