electra2020.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. var EventEmitter = require("events").EventEmitter
  2. var _ = require("lodash");
  3. var async = require("async");
  4. function uberfactory(uuid, slugger) {
  5. var ignores = [
  6. "uninherits",
  7. "inherits",
  8. "unextends",
  9. "extends",
  10. "unisa",
  11. "isa",
  12. "relatesAsToWith",
  13. "test",
  14. "emita",
  15. "emitas",
  16. "data2",
  17. "getStuff",
  18. "pingup",
  19. "data",
  20. "metas2",
  21. "metas",
  22. "metas3",
  23. "exporta",
  24. "pickdeep",
  25. "withAllSync",
  26. "withAll",
  27. "innerExport",
  28. "exportFlatSync",
  29. "exportSync",
  30. "export2",
  31. "export",
  32. "domain",
  33. "_events",
  34. "rawListeners",
  35. "_maxListeners",
  36. "setMaxListeners",
  37. "getMaxListeners",
  38. "emit",
  39. "addListener",
  40. "on",
  41. "prependListener",
  42. "once",
  43. "prependOnceListener",
  44. "removeListener",
  45. "removeAllListeners",
  46. "listeners",
  47. "listenerCount",
  48. "eventNames",
  49. "_data", "path", "name", "children", "parents", "_inherits", "_extends", "_isa",
  50. "_hasa", "_relations", "_references", "_created", "_metas",
  51. "_rootname", "exportSerialised"
  52. ]
  53. return function factory(therootname) {
  54. var seed = therootname;
  55. console.log("ROOT:", therootname);
  56. var ROOT = new electra(therootname, true, false)
  57. function inner(name) {
  58. if (typeof(name) == "undefined") {
  59. return ROOT;
  60. }
  61. name = slugger(name);
  62. if (!ROOT.children[name]) {
  63. ROOT.children[name] = new electra(name);
  64. }
  65. return ROOT.children[name]
  66. }
  67. function electra(name, isroot, parent) {
  68. //name = slugger(name);
  69. this._data = {}
  70. this._metas = {};
  71. this.path = (parent ? parent.path : "") + name;
  72. this.name = name;
  73. //this._id = uuid();
  74. this.children = {};
  75. this.parents = {};
  76. this._inherits = {};
  77. this._extends = {};
  78. this._isa = {};
  79. this._hasa = {};
  80. this._relations = {};
  81. this._references = {};
  82. this._created = new Date();
  83. this._rootname = therootname;
  84. var self = this;
  85. if (parent) {
  86. this.parents[parent.name] = parent;
  87. this.path = parent.path + "/" + name
  88. }
  89. if (isroot) {
  90. this.isroot = true;
  91. return this;
  92. }
  93. function xinner(name) {
  94. var args = Array.prototype.slice.apply(arguments, [0]);
  95. if (args.length > 1) {
  96. return args.map(function(n) {
  97. return xinner(n)
  98. })
  99. }
  100. if (typeof(name) == "undefined") {
  101. return self;
  102. }
  103. name = slugger(name);
  104. if (name.indexOf("://") > -1) {
  105. if (!self.children[name]) {
  106. self.children[name] = new electra(name, false, self);
  107. self.pingup("created", self.children[name](), name)
  108. self.emit("added", name);
  109. }
  110. return self.children[name]
  111. }
  112. if (name.indexOf("/") > -1) {
  113. //its a path;
  114. var arr = name.split("/");
  115. var newname = arr.shift();
  116. if (!self.children[newname]) {
  117. self.children[newname] = new electra(newname, false, self);
  118. self.pingup("created", self.children[newname](), newname, arr)
  119. self.emit("added", newname);
  120. }
  121. return self.children[newname](arr.join("/"))
  122. }
  123. if (!self.children[name]) {
  124. self.children[name] = new electra(name, false, self);
  125. self.pingup("created", self.children[name](), name)
  126. }
  127. return self.children[name]
  128. }
  129. return xinner
  130. }
  131. electra.prototype.__proto__ = EventEmitter.prototype
  132. electra.prototype.inherits = function(obj_) {
  133. var obj = typeof(obj_) === "function" ? obj_() : typeof(obj_) === "object" ? obj_ : typeof(obj_) === "string" ? inner(obj_)() : false
  134. if (obj) {
  135. this._inherits[obj.path] = obj;
  136. obj._extends[this.path] = this;
  137. }
  138. return this;
  139. }
  140. electra.prototype.uninherits = function(obj_) {
  141. var obj = typeof(obj_) === "function" ? obj_() : typeof(obj_) === "object" ? obj_ : typeof(obj_) === "string" ? inner(obj_)() : false
  142. if (obj && this._inherits[obj.path]) {
  143. delete this._inherits[obj.path]
  144. delete obj._extends[this.path]
  145. }
  146. return this;
  147. }
  148. electra.prototype.extends = function(obj_) {
  149. var obj = typeof(obj_) === "function" ? obj_() : typeof(obj_) === "object" ? obj_ : typeof(obj_) === "string" ? inner(obj_)() : false
  150. if (obj) {
  151. this._extends[obj.path] = obj;
  152. obj._inherits[this.path] = this;
  153. }
  154. return this;
  155. }
  156. electra.prototype.unextends = function(obj_) {
  157. var obj = typeof(obj_) === "function" ? obj_() : typeof(obj_) === "object" ? obj_ : typeof(obj_) === "string" ? inner(obj_)() : false
  158. if (obj && this._extends[obj.path]) {
  159. delete this._extends[obj.path]
  160. delete obj._inherits[this.path]
  161. }
  162. return this;
  163. }
  164. electra.prototype.isa = function(elef) {
  165. var self = this;
  166. var args = Array.prototype.slice.apply(arguments, [0]);
  167. if (args.length > 1) {
  168. args.map(function(n) {
  169. var ele = typeof(n) === "function" ? n() : n;
  170. self._isa[ele.path] = ele
  171. ele._hasa[self.path] = self;
  172. self.pingup("isa", self, ele.path)
  173. ele.pingup("isa", self, ele.path)
  174. })
  175. } else {
  176. if (typeof(elef) === "object" && elef.length) {
  177. elef.map(function(n) {
  178. var ele = typeof(n) === "function" ? n() : n;
  179. self._isa[ele.path] = ele
  180. ele._hasa[self.path] = self;
  181. self.pingup("isa", self, ele.path)
  182. ele.pingup("isa", self, ele.path)
  183. })
  184. } else {
  185. var ele = typeof(elef) === "function" ? elef() : typeof(elef) === "object" ? elef : typeof(elef) === "string" ? inner(elef)() : false
  186. if (ele) {
  187. this._isa[ele.path] = ele
  188. ele._hasa[this.path] = this;
  189. self.pingup("isa", self, ele.path)
  190. ele.pingup("isa", self, ele.path)
  191. }
  192. }
  193. }
  194. return this;
  195. }
  196. electra.prototype.unisa = function(elef) {
  197. var self = this;
  198. var args = Array.prototype.slice.apply(arguments, [0]);
  199. if (args.length > 1) {
  200. args.map(function(n) {
  201. var ele = typeof(n) === "function" ? n() : n;
  202. delete self._isa[ele.path]
  203. delete ele._hasa[self.path]
  204. self.pingup("isa", self, ele.path)
  205. ele.pingup("isa", self, ele.path)
  206. })
  207. } else {
  208. if (typeof(elef) === "object" && elef.length) {
  209. elef.map(function(n) {
  210. var ele = typeof(n) === "function" ? n() : n;
  211. delete self._isa[ele.path]
  212. delete ele._hasa[self.path]
  213. self.pingup("isa", self, ele.path)
  214. ele.pingup("isa", self, ele.path)
  215. })
  216. } else {
  217. var ele = typeof(elef) === "function" ? elef() : elef;
  218. delete this._isa[ele.path]
  219. delete ele._hasa[this.path]
  220. self.pingup("isa", self, ele.path)
  221. ele.pingup("isa", self, ele.path)
  222. }
  223. }
  224. return this;
  225. }
  226. electra.prototype.relatesAsToWith = function(relationout, elef, relationto, withstuff) {
  227. var self = this;
  228. if (typeof(relationto) === "undefined") {
  229. relationto = relationout;
  230. }
  231. if (typeof(withstuff) === "undefined") {
  232. withstuff = "";
  233. }
  234. var withstuffOut = Object.assign({
  235. "out": relationout,
  236. "in": relationto
  237. }, withstuff);
  238. var withstuffTo = Object.assign({
  239. "in": relationout,
  240. "out": relationto
  241. }, withstuff);
  242. if (typeof(elef) === "object" && elef.length) {
  243. elef.map(function(n) {
  244. var ele = typeof(n) === "function" ? n() : n;
  245. self._relations[relationout] = self._relations[relationout] || {}
  246. self._relations[relationout][ele.path] = {
  247. ref: ele,
  248. context: withstuffOut
  249. }
  250. ele._relations[relationto] = ele._relations[relationto] || {}
  251. ele._relations[relationto][self.path] = {
  252. ref: self,
  253. context: withstuffTo
  254. }
  255. })
  256. } else {
  257. var ele = typeof(elef) === "function" ? elef() : elef;
  258. self._relations[relationout] = self._relations[relationout] || {}
  259. self._relations[relationout][ele.path] = {
  260. ref: ele,
  261. context: withstuffOut
  262. }
  263. ele._relations[relationto] = ele._relations[relationto] || {}
  264. ele._relations[relationto][self.path] = {
  265. ref: self,
  266. context: withstuffTo
  267. }
  268. }
  269. return this;
  270. }
  271. electra.prototype.test = function() {
  272. return this;
  273. }
  274. electra.prototype.emita = function() {
  275. var self = this;
  276. var args = Array.prototype.slice.apply(arguments, [0]);
  277. var kk = _.keys(this.parents);
  278. if (kk.length > 0) {
  279. kk.map(function(k) {
  280. self.parents[k].emita.apply(self.parents[k], args)
  281. })
  282. } else {}
  283. var kk = _.keys(this.children);
  284. if (kk.length > 0) {
  285. kk.map(function(k) {
  286. //self.children[k].emita.apply(self.children[k],args)
  287. })
  288. } else {}
  289. /* _.map(this.children,function(child,name){
  290. child().emita.apply(child(),args);
  291. }) **/
  292. }
  293. electra.prototype.emitas = function() {
  294. var self = this;
  295. var args = Array.prototype.slice.apply(arguments, [0]);
  296. var kk = _.keys(this.parents);
  297. if (kk.length > 0) {
  298. kk.map(function(k) {
  299. self.parents[k].emita.apply(self.parents[k], args)
  300. })
  301. } else {}
  302. var kk = _.keys(this.children);
  303. if (kk.length > 0) {
  304. kk.map(function(k) {
  305. //self.children[k].emita.apply(self.children[k],args)
  306. })
  307. } else {}
  308. /* _.map(this.children,function(child,name){
  309. child().emita.apply(child(),args);
  310. }) **/
  311. }
  312. electra.prototype.data2 = function(key, value) {
  313. var self = this;
  314. if (typeof(key) === "undefined") {
  315. return this._data;
  316. } else {
  317. if (typeof(value) === "undefined") {
  318. if (typeof(key) === "object") {
  319. var oldvalue = this._data;
  320. this._data = Object.assign(this._data, key);
  321. _.map(this.parents, function(par, nam) {
  322. par.emit("changed", self, "[[object]]", self._data, oldvalue);
  323. })
  324. this.emit("changed", this, "[[object]]", this._data, oldvalue);
  325. return this;
  326. } else {
  327. return this._data[key];
  328. }
  329. } else {
  330. var oldvalue = this._data[key];
  331. this._data[key] = value;
  332. _.map(this.parents, function(par, nam) {
  333. par.emit("changed", self, key, value, oldvalue);
  334. })
  335. this.emit("changed", this, key, value, oldvalue);
  336. return this._data[key];
  337. }
  338. }
  339. }
  340. electra.prototype.getStuff = function(stuff, applybefore, named_, dd) {
  341. var named = named_ || "data";
  342. var dd = dd || false;
  343. var obj = {
  344. name: this.path,
  345. from: named,
  346. data: applybefore(getpath(this, stuff))
  347. }
  348. var arr = [obj];
  349. if (dd) {
  350. return arr
  351. }
  352. arr = [].concat.apply(arr, _.map(this._inherits, function(par, nam) {
  353. return par.getStuff.apply(par, [stuff, applybefore, "inherit_" + named_]);
  354. }))
  355. arr = [].concat.apply(arr, _.map(this.parents, function(par, nam) {
  356. return par.getStuff.apply(par, [stuff, applybefore, "parent_" + named_]);
  357. }))
  358. arr = [].concat.apply(arr, _.map(this._isa, function(par, nam) {
  359. return par.getStuff.apply(par, [stuff, applybefore, "isa_" + named_, true]);
  360. }))
  361. arr = arr.filter(function(a) {
  362. return a.data ? a.data.length > 0 : false
  363. });
  364. return arr
  365. }
  366. electra.prototype.pingup = function() {
  367. var args = Array.prototype.slice.apply(arguments, [0]);
  368. _.map(this.parents, function(par, nam) {
  369. return par.pingup.apply(par, args);
  370. })
  371. this.emit.apply(this, args);
  372. }
  373. electra.prototype.data = function(key, value) {
  374. var self = this;
  375. if (typeof(key) === "undefined") {
  376. return this._data;
  377. } else {
  378. if (typeof(value) === "undefined") {
  379. if (typeof(key) === "object") {
  380. var oldvalue = this._data;
  381. this._data = Object.assign(this._data, key);
  382. this.pingup("changed", self, "[[object]]", self._data, oldvalue)
  383. return this;
  384. } else {
  385. return this._data[key];
  386. }
  387. } else {
  388. var oldvalue = getpath(this._data, key); //this._data[key];
  389. setpath(this._data, key, value)
  390. // this._data[key] = value;
  391. this.pingup("changed", self, key, value, oldvalue)
  392. return getpath(this._data, key); //this._data[key];
  393. }
  394. }
  395. }
  396. electra.prototype.metas = function(key, value) {
  397. var self = this;
  398. if (typeof(key) === "undefined") {
  399. return this._metas;
  400. } else {
  401. if (typeof(value) === "undefined") {
  402. if (typeof(key) === "object") {
  403. var oldvalue = this._metas;
  404. this._metas = Object.assign(this._metas, key);
  405. this.pingup("changed:meta", self, "[[object]]", self._metas, oldvalue)
  406. return this;
  407. } else {
  408. return this._metas[key];
  409. }
  410. } else {
  411. var oldvalue = this._metas[key];
  412. this._metas[key] = value;
  413. this.pingup("changed:meta", self, key, value, oldvalue)
  414. return this._metas[key];
  415. }
  416. }
  417. }
  418. /* electra.prototype.metas = function() {
  419. var self = this;
  420. var args = Array.prototype.slice.apply(arguments, [0]);
  421. if (args.length === 0) {
  422. return this._metas;
  423. }
  424. args.map(function(obj_) {
  425. var obj = typeof(obj_) === "function" ? obj_() : typeof(obj_) === "object" ? obj_ : typeof(obj_) === "string" ? inner(obj_)() : false
  426. if (obj) {
  427. self._metas.push({
  428. "meta": obj,
  429. "data": {}
  430. })
  431. }
  432. })
  433. return this;
  434. }
  435. electra.prototype.metas3 = function(arr) {
  436. var self = this;
  437. self._metas = self._metas.concat(arr);
  438. return self;
  439. }
  440. */
  441. electra.prototype.exporta = function(path) {
  442. this.export(path, function(err, arr) {
  443. // console.log("EXPORTED", err, JSON.stringify(arr, true, 2));
  444. })
  445. }
  446. electra.prototype.pickdeep = function(prop, cb) {
  447. var self = this;
  448. async.mapLimit(this.children, 10, function(obj, next) {
  449. //setTimeout(function(){
  450. obj().pickdeep(prop, next)
  451. //},1)
  452. // next(null,)
  453. }, function(err, collect) {
  454. cb(err, [].concat.apply([self[prop]], collect));
  455. })
  456. return this;
  457. }
  458. electra.prototype.withAllSync = function(func, cb) {
  459. var self = this;
  460. async.mapLimit(this.children, 10, function(obj, next) {
  461. //setTimeout(function(){
  462. obj().withAllSync(func, next)
  463. //},1)
  464. // next(null,)
  465. }, function(err, collect) {
  466. cb(err, [].concat.apply([func(self)], collect));
  467. })
  468. return this;
  469. }
  470. electra.prototype.withAll = function(func, cb) {
  471. var self = this;
  472. async.mapLimit(this.children, 10, function(obj, next) {
  473. obj().withAll(func, next)
  474. }, function(err, collect) {
  475. func(self, function(err2, result) {
  476. cb(err || err2, [].concat.apply([result], collect));
  477. })
  478. })
  479. return this;
  480. }
  481. electra.prototype.exportSync = function(path, serializers) {
  482. var self = this;
  483. var obj = self.innerExport(path, serializers);
  484. var collect = _.map(self.children, function(child, name) {
  485. return child().exportSync(path + "/" + name, serializers)
  486. })
  487. collect.sort(function(a, b) {
  488. return a.name > b.name ? 1 : a.name < b.name ? -1 : 0
  489. })
  490. obj.children = collect;
  491. return obj;
  492. }
  493. electra.prototype.exportFlatSync = function(path) {
  494. var self = this;
  495. return [].concat.apply([self.innerExport(path)], _.map(self.children, function(child, name) {
  496. return child().exportFlatSync(path + "/" + name)
  497. }))
  498. }
  499. electra.prototype.export2 = function(path, cb) {
  500. var self = this;
  501. var obj = self.innerExport(path);
  502. obj.children = _.map(self.children, function(a, n) {
  503. return a().path
  504. });
  505. cb(null, obj);
  506. }
  507. electra.prototype.innerExport = function(path, serializers) {
  508. var self = this;
  509. var obj = {};
  510. // obj._id = self._id;
  511. obj.name = self.name;
  512. obj.path = self.path;
  513. obj.created = self._created.toJSON();
  514. obj.data = self._data;
  515. obj.meta = self._metas;
  516. obj.inherits = _.map(self._inherits, function(a, n) {
  517. return a.path
  518. });
  519. obj.extends = _.map(self._extends, function(a, n) {
  520. return a.path
  521. });
  522. /*obj.parents = _.map(self.parents, function(a, n) {
  523. return a.path
  524. });*/
  525. obj.isa = _.map(self._isa, function(a, n) {
  526. return a.path
  527. });
  528. /*obj.hasa = _.map(self._hasa, function(a, n) {
  529. return a.path
  530. });*/
  531. obj.rel = {};
  532. _.map(self._relations, function(a, n) {
  533. obj.rel[n] = {}
  534. _.map(a, function(aa, nn) {
  535. obj.rel[n][aa.ref.path] = aa.context;
  536. });
  537. });
  538. //clean up
  539. obj.inherits = obj.inherits.length ? obj.inherits : undefined;
  540. obj.extends = obj.extends.length ? obj.extends : undefined;
  541. //obj.parents = obj.parents.length ? obj.parents : undefined;
  542. obj.isa = obj.isa.length ? obj.isa : undefined;
  543. //obj.hasa = obj.hasa.length ? obj.hasa : undefined;
  544. obj.data = _.size(obj.data) ? obj.data : undefined;
  545. obj.meta = _.size(obj.meta) ? obj.meta : undefined;
  546. obj.rel = _.size(obj.rel) ? obj.rel : undefined;
  547. _.keys(obj).map(function(k) {
  548. if (obj[k] === undefined) {
  549. delete obj[k];
  550. //obj[k] = null /* nope */
  551. }
  552. 674555
  553. })
  554. var therest = _.omit(self, ignores);
  555. seriadeep(therest, obj, serializers);
  556. /*_.map(therest, function(val, ke) {
  557. if (typeof(val) === "function") {
  558. obj[ke] = "$$$FUNCTION$$$" + val;
  559. } else {
  560. if (serializers && serializers[ke]) {
  561. obj[ke] = serializers[ke](val);
  562. } else {
  563. _.map(val,function(cval,cprop){
  564. })
  565. obj[ke] = val;
  566. }
  567. }
  568. })
  569. */
  570. return obj
  571. }
  572. function seriadeep(rest, obj, serializers) {
  573. _.map(rest, function(val, ke) {
  574. if (typeof(val) === "function") {
  575. obj[ke] = "$$$FUNCTION$$$" + val;
  576. } else if (typeof(val) === "object") {
  577. obj[ke] = seriadeep(val, obj, serializers);
  578. } else {
  579. if (serializers && serializers[ke]) {
  580. obj[ke] = serializers[ke](val)
  581. } else {
  582. obj[ke] = val;
  583. }
  584. }
  585. })
  586. }
  587. electra.prototype.exportSerialised = function(serializers) {
  588. var self = this;
  589. return function(path, cb) {
  590. async.mapLimit(this.children, 10, function(obj, next) {
  591. obj().exportSerialised(serializers)(path + obj().name, next)
  592. // next(null,)
  593. }, function(err, collect) {
  594. var obj = self.innerExport(path, serializers);
  595. collect.sort(function(a, b) {
  596. return a.name > b.name ? 1 : a.name < b.name ? -1 : 0
  597. })
  598. obj.children = collect;
  599. cb(err, obj);
  600. })
  601. return this;
  602. }
  603. }
  604. electra.prototype.export = function(path, cb) {
  605. var self = this;
  606. async.mapLimit(this.children, 10, function(obj, next) {
  607. obj().export(path + obj().name, next)
  608. // next(null,)
  609. }, function(err, collect) {
  610. var obj = self.innerExport(path);
  611. collect.sort(function(a, b) {
  612. return a.name > b.name ? 1 : a.name < b.name ? -1 : 0
  613. })
  614. obj.children = collect;
  615. cb(err, obj);
  616. })
  617. return this;
  618. }
  619. return inner
  620. }
  621. }
  622. function getpath(obj, path) {
  623. path = path || "";
  624. var arr = path.split(".");
  625. var t = obj;
  626. var done = false;
  627. if (arr.length) {
  628. while (arr.length && !done) {
  629. var check = arr.shift();
  630. if (check !== "") {
  631. t = t[check];
  632. }
  633. if (typeof t !== "object") {
  634. done = true;
  635. }
  636. }
  637. }
  638. return t;
  639. }
  640. function setpath(obj, path, value) {
  641. if (typeof obj !== "object" || !obj) {
  642. throw new Error("obj is not Object");
  643. }
  644. if (typeof path !== "string" || path === "") {
  645. throw new Error("path must be string with length > 0");
  646. }
  647. var arr = path.split(".");
  648. var done = false;
  649. var t = obj;
  650. if (arr.length > 1) {
  651. while (arr.length && t && !done) {
  652. var check = arr.shift();
  653. if (typeof t[check] === "object" && arr.length > 0) {
  654. t = t[check];
  655. } else {
  656. done = true;
  657. arr.unshift(check);
  658. }
  659. }
  660. var xt = t;
  661. while (arr.length) {
  662. var tt = arr.shift();
  663. if (arr.length) { //go deeper
  664. xt = xt[tt] = {};
  665. } else {
  666. //last
  667. xt[tt] = value;
  668. }
  669. }
  670. } else {
  671. if (arr.length === 1 && arr[0] !== "") {
  672. t[arr[0]] = value;
  673. }
  674. }
  675. }
  676. uberfactory.ignores = ignores = [
  677. "inherits",
  678. "uninherits",
  679. "unextends",
  680. "extends",
  681. "isa",
  682. "unisa",
  683. "relatesAsToWith",
  684. "test",
  685. "emita",
  686. "emitas",
  687. "data2",
  688. "getStuff",
  689. "pingup",
  690. "data",
  691. "metas2",
  692. "metas",
  693. "metas3",
  694. "exporta",
  695. "pickdeep",
  696. "withAllSync",
  697. "withAll",
  698. "innerExport",
  699. "exportFlatSync",
  700. "exportSync",
  701. "export2",
  702. "export",
  703. "domain",
  704. "_events",
  705. "rawListeners",
  706. "_maxListeners",
  707. "setMaxListeners",
  708. "getMaxListeners",
  709. "emit",
  710. "addListener",
  711. "on",
  712. "prependListener",
  713. "once",
  714. "prependOnceListener",
  715. "removeListener",
  716. "removeAllListeners",
  717. "listeners",
  718. "listenerCount",
  719. "eventNames",
  720. "_data", "path", "name", "children", "parents", "_inherits", "_extends", "_isa",
  721. "_hasa", "_relations", "_references", "_created", "_metas",
  722. "_rootname", "exportSerialised"
  723. ]
  724. module.exports = uberfactory;