mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 12:22:50 +02:00
Sync pins back from Matrix to Discord
This commit is contained in:
parent
4c62124cee
commit
06b6a63ee3
6 changed files with 87 additions and 0 deletions
17
src/m2d/converters/diff-pins.js
Normal file
17
src/m2d/converters/diff-pins.js
Normal file
|
@ -0,0 +1,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
|
Loading…
Add table
Add a link
Reference in a new issue