Skip to content

Commit 1aa09bf

Browse files
authored
docs: reword some sentences in README (#454)
1 parent f280462 commit 1aa09bf

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,17 @@ So what to do? How to make a `users` array of instances of `User` objects instea
131131
Solution is to create new instances of User object and manually copy all properties to new objects.
132132
But things may go wrong very fast once you have a more complex object hierarchy.
133133

134-
Alternatives? Yes, you can use class-transformer. Purpose of this library is to help you to map you plain javascript
134+
Alternatives? Yes, you can use class-transformer. Purpose of this library is to help you to map your plain javascript
135135
objects to the instances of classes you have.
136136

137137
This library also great for models exposed in your APIs,
138138
because it provides a great tooling to control what your models are exposing in your API.
139-
Here is example how it will look like:
139+
Here is an example how it will look like:
140140

141141
```typescript
142142
fetch('users.json').then((users: Object[]) => {
143143
const realUsers = plainToClass(User, users);
144-
// now each user in realUsers is instance of User class
144+
// now each user in realUsers is an instance of User class
145145
});
146146
```
147147

@@ -226,7 +226,7 @@ let users = plainToClass(User, userJson); // to convert user plain object a sing
226226

227227
### plainToClassFromExist[](#table-of-contents)
228228

229-
This method transforms a plain object into a instance using a already filled Object which is a instance from the target class.
229+
This method transforms a plain object into an instance using an already filled Object which is an instance of the target class.
230230

231231
```typescript
232232
const defaultUser = new User();
@@ -246,19 +246,19 @@ let photo = classToPlain(photo);
246246

247247
### classToClass[](#table-of-contents)
248248

249-
This method transforms your class object into new instance of the class object.
250-
This maybe treated as deep clone of your objects.
249+
This method transforms your class object into a new instance of the class object.
250+
This may be treated as deep clone of your objects.
251251

252252
```typescript
253253
import { classToClass } from 'class-transformer';
254254
let photo = classToClass(photo);
255255
```
256256

257-
You can also use a `ignoreDecorators` option in transformation options to ignore all decorators you classes is using.
257+
You can also use an `ignoreDecorators` option in transformation options to ignore all decorators you classes is using.
258258

259259
### serialize[](#table-of-contents)
260260

261-
You can serialize your model right to the json using `serialize` method:
261+
You can serialize your model right to json using `serialize` method:
262262

263263
```typescript
264264
import { serialize } from 'class-transformer';
@@ -269,14 +269,14 @@ let photo = serialize(photo);
269269

270270
### deserialize and deserializeArray[](#table-of-contents)
271271

272-
You can deserialize your model to from a json using `deserialize` method:
272+
You can deserialize your model from json using the `deserialize` method:
273273

274274
```typescript
275275
import { deserialize } from 'class-transformer';
276276
let photo = deserialize(Photo, photo);
277277
```
278278

279-
To make deserialization to work with arrays use `deserializeArray` method:
279+
To make deserialization work with arrays, use the `deserializeArray` method:
280280

281281
```typescript
282282
import { deserializeArray } from 'class-transformer';
@@ -342,7 +342,7 @@ console.log(plainToClass(User, fromPlainUser, { excludeExtraneousValues: true })
342342
## Working with nested objects[](#table-of-contents)
343343

344344
When you are trying to transform objects that have nested objects,
345-
it's required to know what type of object you are trying to transform.
345+
it's required to known what type of object you are trying to transform.
346346
Since Typescript does not have good reflection abilities yet,
347347
we should implicitly specify what type of object each property contain.
348348
This is done using `@Type` decorator.
@@ -374,8 +374,8 @@ let album = plainToClass(Album, albumJson);
374374
### Providing more than one type option[](#table-of-contents)
375375

376376
In case the nested object can be of different types, you can provide an additional options object,
377-
that specifies a discriminator. The discriminator option must define a `property` that holds the sub
378-
type name for the object and the possible `subTypes`, the nested object can converted to. A sub type
377+
that specifies a discriminator. The discriminator option must define a `property` that holds the subtype
378+
name for the object and the possible `subTypes` that the nested object can converted to. A sub type
379379
has a `value`, that holds the constructor of the Type and the `name`, that can match with the `property`
380380
of the discriminator.
381381

@@ -444,7 +444,7 @@ in the options to keep the discriminator property also inside your resulting cla
444444

445445
## Exposing getters and method return values[](#table-of-contents)
446446

447-
You can expose what your getter or method return by setting a `@Expose()` decorator to those getters or methods:
447+
You can expose what your getter or method return by setting an `@Expose()` decorator to those getters or methods:
448448

449449
```typescript
450450
import { Expose } from 'class-transformer';
@@ -469,8 +469,8 @@ export class User {
469469

470470
## Exposing properties with different names[](#table-of-contents)
471471

472-
If you want to expose some of properties with a different name,
473-
you can do it by specifying a `name` option to `@Expose` decorator:
472+
If you want to expose some of the properties with a different name,
473+
you can do that by specifying a `name` option to `@Expose` decorator:
474474

475475
```typescript
476476
import { Expose } from 'class-transformer';
@@ -511,7 +511,7 @@ export class User {
511511
}
512512
```
513513

514-
Now when you transform a User, `password` property will be skipped and not be included in the transformed result.
514+
Now when you transform a User, the `password` property will be skipped and not be included in the transformed result.
515515

516516
## Skipping depend of operation[](#table-of-contents)
517517

@@ -530,7 +530,7 @@ export class User {
530530
}
531531
```
532532

533-
Now `password` property will be excluded only during `classToPlain` operation. Oppositely, use `toClassOnly` option.
533+
Now `password` property will be excluded only during `classToPlain` operation. Vice versa, use the `toClassOnly` option.
534534

535535
## Skipping all properties of the class[](#table-of-contents)
536536

0 commit comments

Comments
 (0)