Javascript utility functions mainly for Dynamodb
npm install dynamodb-utils* createError
* createResponse
* apiCallHandler
* addObjectProperty
* byteCount
* kilobyteCount
* toKilobyte
* getObjectSize
* itemSizeCount
* objectSizeCount
* arraySizeCount
* stringSizeCount
* numberSizeCount
* binarySizeCOunt
* nullBoolSizeCount
* base64Encode
* base64Decode
* createSet
* createAttribute
* object2Map
* objectOrNull
* attributeOrNull
* isObject
* isArray
* getPropertyPaths
* toStringPath
* toArrayPath
* hasPropertyAtPath
* hasAttributeAtPath
* getAttributeAtPath
* insertMultiObject
* waitForTable
Example
``javascript
// given
{
property1: 'value1',
property2: [1,2,3],
property3: {
property3_1: 'v3.1',
property3_2: {
property3_2_1: {
pickle: 'rick',
morty: {
versions: [
{universe: '31c-12', hasVirginity: true},
{universe: '31c-13', hasVirginity: true},
{universe: '31c-14', hasVirginity: true},
{universe: '31d-10', hasVirginity: true},
{universe: '31d-43', hasVirginity: true},
{universe: '38q-27', hasVirginity: false},
{universe: '47z-02', hasVirginity: true}
]
}
}
},
property3_3: 101
},
property4: {
property4_1: 'baz'
}
}
// returns
{
property1: [],
property2: [
{'0': []},
{'1': []},
{'2': []}
],
property3: [
{'property3_1': []},
{
'property3_2': [
{
'property3_2_1': [
{'pickle': []},
{
'morty': [
{
versions: [
{
universe: [],
hasVirginity: []
}
]
}
]
}
]
}
]
},
{'property3_3': []}
],
property4: [
{'property4_1': []}
]
}
``