UNPKG

rs-restangular

Version:

Restful Resources service for Angular 2 apps

33 lines 1.25 kB
"use strict"; var RestangularElement = (function () { function RestangularElement(object, path) { this.__original__ = object; this.__path__ = path; Object.assign(this, {}, object); } RestangularElement.prototype.clone = function () { return Object.assign(Object.create(this), this); }; RestangularElement.prototype.put = function (body, options) { return this.__path__.put(Object.assign({}, this.plain(), body), options); }; RestangularElement.prototype.remove = function (options) { return this.__path__.remove(options); }; RestangularElement.prototype.plain = function (entity) { var obj = {}; for (var key in this) { if (this.hasOwnProperty(key) && !emptyElement.hasOwnProperty(key)) { obj[key] = this[key]; } } if (entity) { return Object.assign(new entity(), obj); } return Object.assign(Object.create(this.__original__), obj); }; return RestangularElement; }()); exports.RestangularElement = RestangularElement; var emptyElement = new RestangularElement(null, null); //# sourceMappingURL=/home/rodolfosilva/htdocs/outros/restangular/src/element.js.map