Skip to content

Commit 9a4f994

Browse files
committed
doc update and add tranform error
1 parent ba40c77 commit 9a4f994

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ For more control over an attribute's behavior, you can specify an object as the
372372
| delimiter | `string` | *composite keys* | Specifies the delimiter to use if this attribute stores a composite key (see [Using an `array` for composite keys](#using-an-array-for-composite-keys)) |
373373
| prefix | `string` | `string` | A prefix to be added to an attribute when saved to DynamoDB. This prefix will be removed when parsing the data. |
374374
| suffix | `string` | `string` | A suffix to be added to an attribute when saved to DynamoDB. This suffix will be removed when parsing the data. |
375+
| transform | `function` | all | A function that transforms the input before sending to DynamoDB. This accepts two arguments, the value passed to the attribute and the value of the other attributes data. |
375376
| partitionKey | `boolean` or `string` | all | Flags an attribute as the 'partitionKey' for this Entity. If set to `true`, it will be mapped to the Table's `partitionKey`. If set to the name of an **index** defined on the Table, it will be mapped to the secondary index's `partitionKey` |
376377
| sortKey | `boolean` or `string` | all | Flags an attribute as the 'sortKey' for this Entity. If set to `true`, it will be mapped to the Table's `sortKey`. If set to the name of an **index** defined on the Table, it will be mapped to the secondary index's `sortKey` |
377378

lib/parseMapping.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ module.exports = (field,config,track) => {
1616
switch(prop) {
1717
case 'type':
1818
case 'default':
19+
break
1920
case 'transform':
21+
if (typeof config[prop] !== 'function') error(`'${prop}' must be a function`)
2022
break
2123
case 'coerce':
2224
case 'onUpdate':

0 commit comments

Comments
 (0)