pathchain 1.1.14 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/getter.js +4 -4
- package/index.js +13 -0
- package/maker.js +1 -0
- package/package.json +1 -1
package/getter.js
CHANGED
|
@@ -207,7 +207,7 @@ function getObj(xaddress) {
|
|
|
207
207
|
* @param {string} xauthor - The author of the path (optional).
|
|
208
208
|
* @returns {Object|string} The decoded path object or an error message.
|
|
209
209
|
*/
|
|
210
|
-
function
|
|
210
|
+
function getPatheadObj(xpath, xauthor = '') {
|
|
211
211
|
const pathProto = pb(fs.readFileSync('node_modules/pathchain/proto/path.proto'));
|
|
212
212
|
const filePath = `files/${xauthor ? xauthor + '/' : ''}paths/${xpath}`;
|
|
213
213
|
|
|
@@ -216,9 +216,9 @@ function getPathChainObj(xpath, xauthor = '') {
|
|
|
216
216
|
var pathObj = pathProto.path.decode(fileContents);
|
|
217
217
|
|
|
218
218
|
var current_link = this.getObj(pathObj.head);
|
|
219
|
-
console.log("
|
|
219
|
+
console.log("Head link", current_link);
|
|
220
220
|
var current_obj = this.getObj(current_link.target);
|
|
221
|
-
console.log("
|
|
221
|
+
console.log("First object", current_obj);
|
|
222
222
|
// Get link -> get link.target
|
|
223
223
|
return pathObj;
|
|
224
224
|
} catch (err) {
|
|
@@ -238,5 +238,5 @@ module.exports = {
|
|
|
238
238
|
getPathObj,
|
|
239
239
|
getLabelObj,
|
|
240
240
|
getObj,
|
|
241
|
-
|
|
241
|
+
getPatheadObj
|
|
242
242
|
};
|
package/index.js
CHANGED
|
@@ -285,4 +285,17 @@ exports.getLabelObj = (xlabel, xauthor="") => {
|
|
|
285
285
|
exports.getObj = (xaddress) => {
|
|
286
286
|
const pathchain_object = getter.getObj(xaddress);
|
|
287
287
|
return pathchain_object;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** getPathChainObj
|
|
291
|
+
* [Function that recieves a path hash and returns the path object]
|
|
292
|
+
*
|
|
293
|
+
|
|
294
|
+
* Retrieves and decodes a address object from a file.
|
|
295
|
+
* @param {string} xaddress - The address string.
|
|
296
|
+
* @returns {Object|string} The decoded object or an error message.
|
|
297
|
+
*/
|
|
298
|
+
exports.getPatheadObj = (xaddress) => {
|
|
299
|
+
const pathchain_object = getter.getPatheadObj(xaddress);
|
|
300
|
+
return pathchain_object;
|
|
288
301
|
}
|
package/maker.js
CHANGED
|
@@ -230,6 +230,7 @@ function path(text, elements, author, ancestor, format = 'MM DD YYYY HH:mm:SSS [
|
|
|
230
230
|
|
|
231
231
|
let prev_link = "";
|
|
232
232
|
let head_link = "";
|
|
233
|
+
|
|
233
234
|
// Building target chain
|
|
234
235
|
for (let i = 0; i < elements.length; i++) {
|
|
235
236
|
const current_link = link(elements[i], "", "", author, "");
|
package/package.json
CHANGED