@trenskow/pged
Advanced tools
Comparing version 1.2.0 to 1.2.1
13
index.js
@@ -136,2 +136,15 @@ 'use strict'; | ||
}); | ||
}, | ||
patch: async (identifiers, delta) => { | ||
return await this._cacheLock(type, async () => { | ||
if (!this._cache[type]) return; | ||
if (typeof delta === 'function') delta = await Promise.resolve(delta()); | ||
checkType(delta); | ||
let idx = this._cache[type].findIndex((cacheItem) => matches(cacheItem, identifiers)); | ||
if (idx == -1) return; | ||
Object.keys(delta).forEach((key) => { | ||
this._cache[type][idx][key] = delta[key]; | ||
}); | ||
return this._cache[type][idx]; | ||
}); | ||
} | ||
@@ -138,0 +151,0 @@ }; |
{ | ||
"name": "@trenskow/pged", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Just a silly little db management and query builder for Postgresql.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
20199
596