Skip to content

Commit 170c00c

Browse files
committed
Set version 3.0.0 and update readme
1 parent 0abe17d commit 170c00c

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# knockout.mapping
22

3-
[![npm version](https://badge.fury.io/js/knockout-mapping.svg)](http://badge.fury.io/js/ko-mapping)
3+
[![npm version](https://badge.fury.io/js/ko-mapping.svg)](http://badge.fury.io/js/ko-mapping)
44

5-
> Object mapping plugin for [Knockout](http://knockoutjs.com/) with built-in types, forked from https://github.com/crissdev/knockout.mapping
5+
> Object mapping plugin for [Knockout](http://knockoutjs.com/) 3.5+ with built-in types, forked from https://github.com/crissdev/knockout.mapping.
66
77

88
## Documentation
@@ -58,6 +58,39 @@ var newData = ko.mapping.toJS(viewModel);
5858
Run this example in [JSFiddle](http://jsfiddle.net/wmeqx7ss/280/).
5959

6060

61+
## Migrating from knockout.mapping or knockout-mapping?
62+
63+
```bash
64+
npm uninstall knockout-mapping
65+
# or
66+
npm uninstall knockout.mapping
67+
68+
npm install ko-mapping
69+
```
70+
71+
### Update imports
72+
73+
Update all your imports:
74+
75+
```diff
76+
- import mapping from 'knockout-mapping';
77+
+ import mapping from 'ko-mapping';
78+
```
79+
80+
81+
### Update types
82+
83+
If you used `KnockoutObservableType` (or [any of the other types](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/knockout.mapping/index.d.ts)) from the old `@types/knockout.mapping` package, you need to update to use `MappedObservable`:
84+
85+
86+
```diff
87+
- const myObj: KnockoutObservableType<SomeObject>;
88+
+ import { MappedObservable } from 'ko-mapping';
89+
+ const myObj: MappedObservable<SomeObject>;
90+
```
91+
92+
If you happened to still use some types from `@types/knockout` (you shouldn't; types are included with Knockout 3.5), you need to update those as well. You might have used `KnockoutSubcription` or `KnockoutObservable`; use `ko.Subscription` or `ko.Observable` instead.
93+
6194
## Test
6295

6396
Unless `CI` environment variable is defined, the tests use the latest version Knockout.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
"types": "types/knockout.mapping.d.ts",
77
"files": [
88
"dist",
9-
"HISTORY.md"
9+
"HISTORY.md",
10+
"types"
1011
],
1112
"engines": {
12-
"node": ">=6.9.5"
13+
"node": ">=18"
1314
},
1415
"keywords": [
1516
"knockout",
@@ -40,7 +41,7 @@
4041
},
4142
"repository": {
4243
"type": "git",
43-
"url": "https://github.com/eithe/knockout.mapping.git"
44+
"url": "git+https://github.com/eithe/knockout.mapping.git"
4445
},
4546
"bugs": {
4647
"url": "https://github.com/eithe/knockout.mapping/issues"

0 commit comments

Comments
 (0)