immutablediff
Version:
Create RFC 6902 style patches between Immutable.JS data structures
18 lines (13 loc) • 445 B
JavaScript
;
var Immutable = require('immutable');
var isMap = function(obj){ return Immutable.Iterable.isKeyed(obj); };
var isIndexed = function(obj) { return Immutable.Iterable.isIndexed(obj); };
var op = function(operation, path, value){
if(operation === 'remove') { return { op: operation, path: path }; }
return { op: operation, path: path, value: value };
};
module.exports = {
isMap: isMap,
isIndexed: isIndexed,
op: op
};