UNPKG

agson

Version:

Querying and manipulating JSON graphs

59 lines (40 loc) 1.49 kB
(function() { var Just, Store, notImplemented, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; Just = require('data.maybe').Just; notImplemented = require('./util').notImplemented; module.exports = Store = (function() { function Store() {} Store.of = function(M) { return function(s) { return new ((function(_super) { __extends(_Class, _super); function _Class() { return _Class.__super__.constructor.apply(this, arguments); } _Class.prototype.point = M.of; _Class.prototype.modify = s.modify || notImplemented; _Class.prototype.get = s.get || notImplemented; return _Class; })(Store)); }; }; Store.prototype.point = notImplemented; Store.prototype.modify = notImplemented; Store.prototype.get = notImplemented; Store.prototype.set = function(b) { return this.modify((function(_this) { return function() { return _this.point(b); }; })(this)); }; Store.prototype.map = function(f) { return this.modify(function(a) { return a.map(f); }); }; return Store; })(); }).call(this);