maputnik/src/libs/diffmessage.js
2016-12-31 14:32:04 +01:00

13 lines
491 B
JavaScript

import diffStyles from 'mapbox-gl-style-spec/lib/diff'
export function diffMessages(beforeStyle, afterStyle) {
const changes = diffStyles(beforeStyle, afterStyle)
return changes.map(cmd => cmd.command + ' ' + cmd.args.join(' '))
}
export function undoMessages(beforeStyle, afterStyle) {
return diffMessages(beforeStyle, afterStyle).map(m => 'Undo ' + m)
}
export function redoMessages(beforeStyle, afterStyle) {
return diffMessages(beforeStyle, afterStyle).map(m => 'Redo ' + m)
}