https://github.com/ironsource/node-dynamodb-path
https://github.com/ironsource/node-dynamodb-path
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ironsource/node-dynamodb-path
- Owner: ironSource
- License: mit
- Created: 2015-10-24T23:27:19.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-26T09:49:39.000Z (over 10 years ago)
- Last Synced: 2025-11-27T09:32:27.198Z (7 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# dynamodb-path
**Convert an array path like `['x', '291', '2', 'beep', 283]` to a string path like `#x[291][2].#beep[283]` suitable for DynamoDB UpdateExpressions.**
[](https://www.npmjs.org/package/dynamodb-path) [](https://david-dm.org/ironSource/node-dynamodb-path)
## example
```js
var ddbPath = require('dynamodb-path')
var escape = (s) => '#' + s
var arr = ['x', '291', '2', 'beep', 283]
var str = ddbPath(arr, escape)
console.log(str) // #x[291][2].#beep[283]
```
## api
### `ddbPath(path[, map])`
Takes an array, returns a string. Will throw if `path` is invalid. If a `map` function is provided, it will be called for every string segment. You can use this mapper to escape segments and collect names for ExpressionAttributeNames.
## install
With [npm](https://npmjs.org) do:
```
npm install dynamodb-path
```
## license
[MIT](http://opensource.org/licenses/MIT) © ironSource