( sourceData: Record<string, any>, delta: Delta, force: boolean | undefined, onlyKeys: string[], )
| 35 | * gets counted) so the two can never disagree on scope. |
| 36 | */ |
| 37 | export function computeProcessableData( |
| 38 | sourceData: Record<string, any>, |
| 39 | delta: Delta, |
| 40 | force: boolean | undefined, |
| 41 | onlyKeys: string[], |
| 42 | ): Record<string, any> { |
| 43 | return _.chain(sourceData) |
| 44 | .entries() |
| 45 | .filter( |
| 46 | ([key]) => |
| 47 | delta.added.includes(key) || delta.updated.includes(key) || !!force, |
| 48 | ) |
| 49 | .filter( |
| 50 | ([key]) => |
| 51 | !onlyKeys.length || |
| 52 | onlyKeys.some((pattern) => |
| 53 | minimatch(safeDecode(key), safeDecode(pattern)), |
| 54 | ), |
| 55 | ) |
| 56 | .fromPairs() |
| 57 | .value(); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Determines the user's identity for tracking purposes. |
no test coverage detected