blob: e6e038bdb75291064665fc968c20989cfc909b27 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// @ts-check
/**
* @param {string[]} pins
* @param {string[]} prev
* @returns {[string, boolean][]}
*/
function diffPins(pins, prev) {
/** @type {[string, boolean][]} */
const result = []
return result.concat(
prev.filter(id => !pins.includes(id)).map(id => [id, false]), // removed
pins.filter(id => !prev.includes(id)).map(id => [id, true]) // added
)
}
module.exports.diffPins = diffPins
|