From 6aff4c9031807b4e2c120d28a13418795bf45eb6 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Fri, 31 Aug 2018 17:24:35 +0200 Subject: [PATCH] implement JSON methods for tree --- package-lock.json | 532 ++++++++++++++++++++++++--------------- package.json | 14 +- test/test.looptracker.ts | 2 +- test/test.objectmap.ts | 2 +- test/test.stringmap.ts | 2 +- test/test.tree.ts | 20 +- ts/lik.tree.ts | 27 +- 7 files changed, 380 insertions(+), 219 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5b168ea..b71bbaa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,66 +14,255 @@ "nan": "^2.9.2" } }, - "@gitzone/tsrun": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@gitzone/tsrun/-/tsrun-1.1.9.tgz", - "integrity": "sha512-MbCLj4hSK5nY6cMqT0OxY0BrXffmiC1Rjbzan8CmEpB8OttaAJT+zsJErJWhI+pk4s75Te73PyhHYaJAXUoJhw==", + "@gitzone/tsbuild": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/@gitzone/tsbuild/-/tsbuild-2.0.22.tgz", + "integrity": "sha512-H0rqGVUKXWgxXhkY62kF92WpbS9GSJW27jQXaoyMsQptTQN4HIYKHWZMdO4egkk0/gDmKnBjk8MXg5Rx6efItA==", "dev": true, "requires": { - "@pushrocks/smartfile": "^6.0.3", + "@pushrocks/smartfile": "^6.0.6", + "@pushrocks/smartlog": "^2.0.1", + "@pushrocks/smartpath": "^4.0.1", + "@pushrocks/smartpromise": "^2.0.5", + "typescript": "^3.0.1" + }, + "dependencies": { + "@pushrocks/smartfile": { + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/@pushrocks/smartfile/-/smartfile-6.0.8.tgz", + "integrity": "sha512-YkAovvQ0pcVphXLynlQ1D4nhEoUqALqqUn2pRXc2vXNy0RDSU22puLlLVhoXT0NPAqYNMazhqc4OAixgEOpdFw==", + "dev": true, + "requires": { + "@pushrocks/smartpath": "^4.0.1", + "@pushrocks/smartpromise": "^2.0.5", + "@pushrocks/smartrequest": "^1.1.14", + "@types/fs-extra": "^5.0.4", + "@types/vinyl": "^2.0.2", + "fs-extra": "^7.0.0", + "glob": "^7.1.2", + "js-yaml": "^3.10.0", + "vinyl-file": "^3.0.0" + } + }, + "@pushrocks/smartrequest": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@pushrocks/smartrequest/-/smartrequest-1.1.14.tgz", + "integrity": "sha512-+sDQB4Mxvpn8BIMPUQ7TPSCKUVMln3tHC4rp4pmfEHmBQK+g1XwtNr59aMA9kEoBDMt7li1hu+1cs+SNsWt6Gw==", + "dev": true, + "requires": { + "@pushrocks/smartpromise": "^2.0.5", + "@types/form-data": "^2.2.1", + "form-data": "^2.3.2" + } + }, + "fs-extra": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "typescript": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", + "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", + "dev": true + } + } + }, + "@gitzone/tsrun": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/@gitzone/tsrun/-/tsrun-1.1.12.tgz", + "integrity": "sha512-DOxqOg+evoxhgbzhzH4u6LaPF+6bpMsnBVl1QQaHzKPGBlNjaIY4yJ0RsGnWMgX1hlNLvbgHtl0Ky4A2MDvyrg==", + "dev": true, + "requires": { + "@gitzone/tsbuild": "^2.0.22", + "@pushrocks/smartfile": "^6.0.6", "ts-node": "^7.0.0", - "typescript": "^2.9.1" + "typescript": "^3.0.1" + } + }, + "@gitzone/tstest": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/@gitzone/tstest/-/tstest-1.0.15.tgz", + "integrity": "sha512-+t5fvYK4a0JkwwH0Fokh5aOxVzrax5OjDUL4zmhBk7KFmXt7fdvcqsSNaEp9iyqC52dLiDybdAXqHYZypXTIYw==", + "dev": true, + "requires": { + "@gitzone/tsrun": "^1.1.12", + "@pushrocks/consolecolor": "^2.0.1", + "@pushrocks/smartfile": "^6.0.6", + "@pushrocks/smartlog": "^2.0.1", + "@pushrocks/smartpromise": "^2.0.5", + "@pushrocks/smartshell": "^2.0.6", + "@types/figures": "^2.0.0", + "figures": "^2.0.0" + }, + "dependencies": { + "@gitzone/tsrun": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/@gitzone/tsrun/-/tsrun-1.1.12.tgz", + "integrity": "sha512-DOxqOg+evoxhgbzhzH4u6LaPF+6bpMsnBVl1QQaHzKPGBlNjaIY4yJ0RsGnWMgX1hlNLvbgHtl0Ky4A2MDvyrg==", + "dev": true, + "requires": { + "@gitzone/tsbuild": "^2.0.22", + "@pushrocks/smartfile": "^6.0.6", + "ts-node": "^7.0.0", + "typescript": "^3.0.1" + } + }, + "@pushrocks/smartfile": { + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/@pushrocks/smartfile/-/smartfile-6.0.8.tgz", + "integrity": "sha512-YkAovvQ0pcVphXLynlQ1D4nhEoUqALqqUn2pRXc2vXNy0RDSU22puLlLVhoXT0NPAqYNMazhqc4OAixgEOpdFw==", + "dev": true, + "requires": { + "@pushrocks/smartpath": "^4.0.1", + "@pushrocks/smartpromise": "^2.0.5", + "@pushrocks/smartrequest": "^1.1.14", + "@types/fs-extra": "^5.0.4", + "@types/vinyl": "^2.0.2", + "fs-extra": "^7.0.0", + "glob": "^7.1.2", + "js-yaml": "^3.10.0", + "vinyl-file": "^3.0.0" + } + }, + "@pushrocks/smartrequest": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@pushrocks/smartrequest/-/smartrequest-1.1.14.tgz", + "integrity": "sha512-+sDQB4Mxvpn8BIMPUQ7TPSCKUVMln3tHC4rp4pmfEHmBQK+g1XwtNr59aMA9kEoBDMt7li1hu+1cs+SNsWt6Gw==", + "dev": true, + "requires": { + "@pushrocks/smartpromise": "^2.0.5", + "@types/form-data": "^2.2.1", + "form-data": "^2.3.2" + } + }, + "fs-extra": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "typescript": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", + "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", + "dev": true + } + } + }, + "@pushrocks/consolecolor": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@pushrocks/consolecolor/-/consolecolor-2.0.1.tgz", + "integrity": "sha512-iOFCHVeFZ2OywbdwSxVI4/wokkcLrXVdHLgvMmkNhJ220eeLgjNZWx3EJo3vNW3zq5ybCSCUIq0878djBxrWpw==", + "dev": true, + "requires": { + "ansi-256-colors": "^1.1.0" + } + }, + "@pushrocks/early": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@pushrocks/early/-/early-3.0.3.tgz", + "integrity": "sha512-71/nwxTpqdp1glmHz4YaGusNl/XOOcPelAxC9RA6rpS/6280QyY2u4yx+mRdMrCzn7ruLYF5awbkS8llNZ94Pg==", + "dev": true, + "requires": { + "@pushrocks/consolecolor": "^2.0.1", + "@pushrocks/smartpromise": "^2.0.5" } }, "@pushrocks/smartdelay": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.1.tgz", - "integrity": "sha512-olWwh2/JWfhmYdgqrR5RdSsgv1GlXBnbP+XKUrdKVk3dcCzkoqDx9lRE9NfpoCg1cUM2VMxbTVgTW9PWyexEuw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.2.tgz", + "integrity": "sha512-4xf6tMKwZcxBynKgXrM4SQKgeASfRvx43LUmR5DkStp26ZHAsarCXUdKJS6y8QIPygEOTOCP8we97JAcCzBuMg==", "dev": true, "requires": { "@pushrocks/smartpromise": "^2.0.5" } }, "@pushrocks/smartfile": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@pushrocks/smartfile/-/smartfile-6.0.3.tgz", - "integrity": "sha512-oYnLQzY/R6kVNerbWY4WwnPvdxXldrzMPWcB9j0aAdSDSqGwBEO1/ZFTQuNzN5MmPopoYmJrc06ZmI6dm4OJmw==", + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/@pushrocks/smartfile/-/smartfile-6.0.8.tgz", + "integrity": "sha512-YkAovvQ0pcVphXLynlQ1D4nhEoUqALqqUn2pRXc2vXNy0RDSU22puLlLVhoXT0NPAqYNMazhqc4OAixgEOpdFw==", "dev": true, "requires": { + "@pushrocks/smartpath": "^4.0.1", "@pushrocks/smartpromise": "^2.0.5", - "@pushrocks/smartrequest": "^1.0.15", - "@types/fs-extra": "^5.0.3", + "@pushrocks/smartrequest": "^1.1.14", + "@types/fs-extra": "^5.0.4", "@types/vinyl": "^2.0.2", - "fs-extra": "^6.0.1", + "fs-extra": "^7.0.0", "glob": "^7.1.2", "js-yaml": "^3.10.0", - "smartpath": "^3.2.8", "vinyl-file": "^3.0.0" } }, + "@pushrocks/smartlog": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@pushrocks/smartlog/-/smartlog-2.0.1.tgz", + "integrity": "sha512-GtsDTGIUF3VuWPyF8FV5dF31ZCEIcaJ56ZlvJsWxjnyJq57X25mk5/K0QAaRE9IIeHg6fORcukFomb5C+AOQrg==", + "dev": true, + "requires": { + "@pushrocks/smartlog-interfaces": "^1.0.9" + } + }, + "@pushrocks/smartlog-interfaces": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@pushrocks/smartlog-interfaces/-/smartlog-interfaces-1.0.9.tgz", + "integrity": "sha512-0qwpomrRN0kFjmhR9m1iHYXoISoNuXtRP0Wr+JtkYyURLwKHMaW8Xoznf8MzXJptRfqufJi3Fxh5HodpPrIZUA==", + "dev": true + }, + "@pushrocks/smartpath": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@pushrocks/smartpath/-/smartpath-4.0.1.tgz", + "integrity": "sha512-MaI0+uLQPCr2V3WGnbdgb0pWa9xkWyrP4qYcbsHIjeismGLbn9s3jmP/HIXU8LkgzRgaVb+BJxmZJHOwl32DyA==", + "dev": true + }, "@pushrocks/smartpromise": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@pushrocks/smartpromise/-/smartpromise-2.0.5.tgz", "integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g==" }, "@pushrocks/smartrequest": { - "version": "1.0.15", - "resolved": "https://registry.npmjs.org/@pushrocks/smartrequest/-/smartrequest-1.0.15.tgz", - "integrity": "sha512-nM+ctwMOs3gPJvw3cGouBimKQxCM93bnmv2+Jk9cbT29/UVVI/UjIdAU3OnUYFpzq496/QUAQD0kNsmYNkqmhQ==", + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@pushrocks/smartrequest/-/smartrequest-1.1.14.tgz", + "integrity": "sha512-+sDQB4Mxvpn8BIMPUQ7TPSCKUVMln3tHC4rp4pmfEHmBQK+g1XwtNr59aMA9kEoBDMt7li1hu+1cs+SNsWt6Gw==", "dev": true, "requires": { - "smartq": "^1.1.1" + "@pushrocks/smartpromise": "^2.0.5", + "@types/form-data": "^2.2.1", + "form-data": "^2.3.2" + } + }, + "@pushrocks/smartshell": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@pushrocks/smartshell/-/smartshell-2.0.6.tgz", + "integrity": "sha512-D48KB3DDqLfMjOXGEutqJi+v3Z4RcWacu5BJXxUwrecvd6oetbKobfmNGxeHSQPmNGb7U3ISfKwV6c5T5EZkJg==", + "dev": true, + "requires": { + "@pushrocks/smartpromise": "^2.0.5", + "@types/which": "^1.3.1", + "which": "^1.3.1" } }, "@pushrocks/tapbundle": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.1.tgz", - "integrity": "sha512-QWVz5EwB3sjjqHTMa22xuw78TBgVTyqKTF5H6HT9d/rvxL5Ag4ZrTuoadMPcU9hRBx9gtPsKbWq4lEwOHdCmLA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.5.tgz", + "integrity": "sha512-7K1y4pyJ5O8XRmnW/ADryEoniGKOW0Un6VZpxMcYTndS5AjwKhjRkAAaSQf4g/a8Ei+uk/q8csI9Twjb9KISLQ==", "dev": true, "requires": { - "@pushrocks/smartdelay": "^2.0.1", + "@pushrocks/early": "^3.0.3", + "@pushrocks/smartdelay": "^2.0.2", "@pushrocks/smartpromise": "^2.0.5", - "early": "^2.1.1", "leakage": "^0.4.0", "smartchai": "^2.0.1" } @@ -102,6 +291,21 @@ "@types/chai": "*" } }, + "@types/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-mcRgJ+ncKuNI+Dwac7omO18B8C8u+YBS+AU/oyLhEyjAnT3cUUThhHgZpbiIvu5ZqSvdD30BXtrqg9nxc3OKMg==", + "dev": true + }, + "@types/form-data": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", + "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/fs-extra": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.4.tgz", @@ -112,9 +316,9 @@ } }, "@types/lodash": { - "version": "4.14.112", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.112.tgz", - "integrity": "sha512-jDD7sendv3V7iwyRXSlECOR8HCtMN2faVA9ngLdHHihSVIwY7nbfsKl2kA6fimUDU1i5l/zgpG3aevwWnN3zCQ==" + "version": "4.14.116", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", + "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==" }, "@types/minimatch": { "version": "3.0.3", @@ -122,9 +326,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "10.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.2.tgz", - "integrity": "sha512-m9zXmifkZsMHZBOyxZWilMwmTlpC8x5Ty360JKTiXvlXZfBWYpsg9ZZvP/Ye+iZUh+Q+MxDLjItVTWIsfwz+8Q==", + "version": "10.9.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.9.4.tgz", + "integrity": "sha512-fCHV45gS+m3hH17zgkgADUSi2RR1Vht6wOZ0jyHP8rjiQra9f+mIcgwPQHllmDocYOstIEbKlxbFDYlgrTPYqw==", "dev": true }, "@types/vinyl": { @@ -136,6 +340,12 @@ "@types/node": "*" } }, + "@types/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@types/which/-/which-1.3.1.tgz", + "integrity": "sha512-ZrJDWpvg75LTGX4XwuneY9s6bF3OeZcGTpoGh3zDV9ytzcHMFsRrMIaLBRJZQMBoGyKs6unBQfVdrLZiYfb1zQ==", + "dev": true + }, "ansi-256-colors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz", @@ -163,21 +373,17 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, - "beautycolor": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/beautycolor/-/beautycolor-1.0.11.tgz", - "integrity": "sha512-Uxl/39+2uqixPzsrV+0NOHf0sJlWmsKnRTV0oz8+bfwnHPA/E+SZuh3Upn3OXobv0W7LZg5BVoLj1nkMj7m5jA==", - "dev": true, - "requires": { - "ansi-256-colors": "^1.1.0", - "typings-global": "^1.0.14" - } - }, "bindings": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", @@ -263,6 +469,15 @@ "readable-stream": "^2.3.5" } }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -283,15 +498,11 @@ "type-detect": "^4.0.0" } }, - "define-properties": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", - "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", - "dev": true, - "requires": { - "foreach": "^2.0.5", - "object-keys": "^1.0.8" - } + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, "diff": { "version": "3.5.0", @@ -299,53 +510,33 @@ "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, - "early": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/early/-/early-2.1.1.tgz", - "integrity": "sha1-hB4jJU6l3FTYr67ugvWrZcAO4jw=", - "dev": true, - "requires": { - "beautycolor": "^1.0.7", - "smartq": "^1.1.1", - "typings-global": "^1.0.16" - } - }, - "es-abstract": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", - "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.1.1", - "function-bind": "^1.1.1", - "has": "^1.0.1", - "is-callable": "^1.1.3", - "is-regex": "^1.0.4" - } - }, - "es-to-primitive": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", - "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", - "dev": true, - "requires": { - "is-callable": "^1.1.1", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.1" - } - }, "es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "first-chunk-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz", @@ -355,16 +546,21 @@ "readable-stream": "^2.0.2" } }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } }, "fs-extra": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", - "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", + "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -378,12 +574,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", @@ -421,24 +611,6 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "home": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/home/-/home-1.0.1.tgz", - "integrity": "sha1-lqQjzrSbmDeP9e886uBZpVf53TU=", - "dev": true, - "requires": { - "os-homedir": "^1.0.1" - } - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -455,33 +627,6 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", - "dev": true - }, - "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true - }, - "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, - "requires": { - "has": "^1.0.1" - } - }, - "is-symbol": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", - "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", - "dev": true - }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -494,6 +639,12 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "js-yaml": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", @@ -543,6 +694,21 @@ "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", "dev": true }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "~1.36.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -575,27 +741,11 @@ } }, "nan": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==", "dev": true }, - "object-keys": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", - "dev": true - }, - "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -605,12 +755,6 @@ "wrappy": "1" } }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -688,25 +832,6 @@ "chai-string": "^1.4.0" } }, - "smartpath": { - "version": "3.2.8", - "resolved": "https://registry.npmjs.org/smartpath/-/smartpath-3.2.8.tgz", - "integrity": "sha1-SDS9OouuIpW6rK26I8h6UBlS+UA=", - "dev": true, - "requires": { - "home": "^1.0.1", - "typings-global": "^1.0.14" - } - }, - "smartq": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz", - "integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==", - "dev": true, - "requires": { - "util.promisify": "^1.0.0" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -794,15 +919,9 @@ "dev": true }, "typescript": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", - "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", - "dev": true - }, - "typings-global": { - "version": "1.0.28", - "resolved": "https://registry.npmjs.org/typings-global/-/typings-global-1.0.28.tgz", - "integrity": "sha512-6VOwJWEY2971HOMHu/7sURzUXiD4/LiMJPsMAOqkHHAtS3MVpLFE5gzTiHilsH9KY5VE1mBQirWIgWFsDuo90A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", + "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", "dev": true }, "universalify": { @@ -817,16 +936,6 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "util.promisify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", - "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, "vinyl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", @@ -854,6 +963,15 @@ "vinyl": "^2.0.1" } }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index c0d8fb1..6a65783 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "main": "dist/index.js", "typings": "dist/index.d.ts", "scripts": { - "test": "tsrun test/test.ts", - "build": "(npmts)" + "test": "(tstest test/)", + "build": "(tsbuild)" }, "repository": { "type": "git", @@ -20,13 +20,15 @@ }, "homepage": "https://gitlab.com/pushrocks/lik#README", "devDependencies": { - "@gitzone/tsrun": "^1.1.9", - "@pushrocks/tapbundle": "^3.0.1", - "@types/node": "^10.5.2" + "@gitzone/tsbuild": "^2.0.22", + "@gitzone/tsrun": "^1.1.12", + "@gitzone/tstest": "^1.0.15", + "@pushrocks/tapbundle": "^3.0.5", + "@types/node": "^10.9.4" }, "dependencies": { "@pushrocks/smartpromise": "^2.0.5", - "@types/lodash": "^4.14.112", + "@types/lodash": "^4.14.116", "@types/minimatch": "^3.0.3", "lodash": "^4.17.10", "minimatch": "^3.0.4", diff --git a/test/test.looptracker.ts b/test/test.looptracker.ts index 8e0df04..07887be 100644 --- a/test/test.looptracker.ts +++ b/test/test.looptracker.ts @@ -1,7 +1,7 @@ // import test framework import { expect, tap } from '@pushrocks/tapbundle'; import * as events from 'events'; -import * as smartq from 'smartq'; +import * as smartpromise from '@pushrocks/smartpromise'; // import the module import * as lik from '../ts/index'; diff --git a/test/test.objectmap.ts b/test/test.objectmap.ts index 638c6c1..5c1a7ac 100644 --- a/test/test.objectmap.ts +++ b/test/test.objectmap.ts @@ -1,7 +1,7 @@ // import test framework import { expect, tap } from '@pushrocks/tapbundle'; import * as events from 'events'; -import * as smartq from 'smartq'; +import * as smartpromise from '@pushrocks/smartpromise'; // import the module import * as lik from '../ts/index'; diff --git a/test/test.stringmap.ts b/test/test.stringmap.ts index 8d7dd0f..4cdddd7 100644 --- a/test/test.stringmap.ts +++ b/test/test.stringmap.ts @@ -1,7 +1,7 @@ // import test framework import { expect, tap } from '@pushrocks/tapbundle'; import * as events from 'events'; -import * as smartq from 'smartq'; +import * as smartpromise from '@pushrocks/smartpromise'; // import the module import * as lik from '../ts/index'; diff --git a/test/test.tree.ts b/test/test.tree.ts index 90055ec..c86b47a 100644 --- a/test/test.tree.ts +++ b/test/test.tree.ts @@ -1,14 +1,20 @@ import { tap, expect } from '@pushrocks/tapbundle'; import * as lik from '../ts/index'; -let testTree = new lik.Tree(); - class TestClass { constructor(public hey: string) { // nothing here } } + +let testTree = new lik.Tree(); + let testInstance = new TestClass('first'); +let testInstance2 = new TestClass('second'); +let testInstance3 = new TestClass('third'); +let testInstance4 = new TestClass('fourth'); +let testInstance5 = new TestClass('fifth'); +let testInstance6 = new TestClass('sixth'); tap.test('create a valid tree instance', async () => { testTree = new lik.Tree(); @@ -21,4 +27,14 @@ tap.test('should insert an object', async () => { expect(resultArray).to.contain(testInstance); }); +tap.test('should add other objects in a hierachy', async () => { + testTree.appendChild(testInstance, testInstance2); + testTree.appendChild(testInstance, testInstance3); + testTree.appendChild(testInstance, testInstance4); +}) + +tap.test('should create a JSON object that reflects a tree\'s hierachy', async () => { + const jsonTreet = testTree.toJsonWithHierachy(testInstance); +}); + tap.start(); diff --git a/ts/lik.tree.ts b/ts/lik.tree.ts index 67018f7..d4589f9 100644 --- a/ts/lik.tree.ts +++ b/ts/lik.tree.ts @@ -6,6 +6,10 @@ export class Tree { this.symbolTree = new plugins.symbolTree(); } + // ======================================= + // Functions that map to the functionality of symbol-tree + // ======================================= + /** * * @param objectArg @@ -78,7 +82,7 @@ export class Tree { this.symbolTree.ancestorsIterator(); } - treeIterator(rootArg: T, optionsArg): T { + treeIterator(rootArg: T, optionsArg): Iterable { return this.symbolTree.treeIterator(rootArg); } @@ -113,4 +117,25 @@ export class Tree { appendChild(referenceObjectArg, newObjectArg) { return this.symbolTree.appendChild(referenceObjectArg, newObjectArg); } + + // =========================================== + // Functionionality that extends symbol-tree + // =========================================== + + /** + * returns a branch of the tree as JSON + * can be user + */ + toJsonWithHierachy(rootElement) { + const treeIterable = this.treeIterator(rootElement, {}); + for (const treeItem of treeIterable) { + console.log(treeItem); + } + } + + /** + * builds a tree from a JSON with hierachy + * @param rootElement + */ + fromJsonWithHierachy(rootElement) {} }