2018-08-05 18:19:48 +02:00
|
|
|
import Attributes from "./attributes";
|
2018-07-23 11:12:06 +00:00
|
|
|
|
2018-08-05 18:19:48 +02:00
|
|
|
function Snippet(def, anchor, description = "") {
|
2018-07-23 11:12:06 +00:00
|
|
|
this.def = def;
|
|
|
|
this.anchor = anchor;
|
|
|
|
this.description = description;
|
2018-08-05 18:19:48 +02:00
|
|
|
this.attributes = new Attributes();
|
2018-07-23 11:12:06 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2018-08-03 14:20:28 +02:00
|
|
|
/** Returns a deep copy of this */
|
2018-08-05 18:19:48 +02:00
|
|
|
Snippet.prototype.clone = function() {
|
|
|
|
let clone = new Snippet(this.def, this.anchor.clone(), this.description);
|
2018-08-03 14:20:28 +02:00
|
|
|
clone.attributes = this.attributes.clone();
|
|
|
|
|
|
|
|
return clone;
|
|
|
|
};
|
|
|
|
|
2018-08-05 18:19:48 +02:00
|
|
|
export default Snippet;
|