{"id":27261331,"url":"https://github.com/datkt/flat-tree","last_synced_at":"2026-01-12T05:35:44.687Z","repository":{"id":57106245,"uuid":"154853189","full_name":"datkt/flat-tree","owner":"datkt","description":" Port of @mafintosh's flat-tree functions to map a binary tree to a list.","archived":false,"fork":false,"pushed_at":"2019-08-07T14:01:19.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-23T03:02:41.212Z","etag":null,"topics":["binary","dat","flat","node","npm","tree"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datkt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-26T15:11:02.000Z","updated_at":"2019-08-07T14:01:21.000Z","dependencies_parsed_at":"2022-08-21T01:00:58.023Z","dependency_job_id":null,"html_url":"https://github.com/datkt/flat-tree","commit_stats":null,"previous_names":["datkt/flattree"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/datkt/flat-tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datkt%2Fflat-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datkt%2Fflat-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datkt%2Fflat-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datkt%2Fflat-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datkt","download_url":"https://codeload.github.com/datkt/flat-tree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datkt%2Fflat-tree/sbom","scorecard":{"id":325028,"data":{"date":"2025-08-11","repo":{"name":"github.com/datkt/flat-tree","commit":"51903973b1eff59b5b38ac1afa945ba483069eca"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 2/15 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T02:13:18.017Z","repository_id":57106245,"created_at":"2025-08-18T02:13:18.017Z","updated_at":"2025-08-18T02:13:18.017Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28335209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary","dat","flat","node","npm","tree"],"created_at":"2025-04-11T05:29:33.214Z","updated_at":"2026-01-12T05:35:44.659Z","avatar_url":"https://github.com/datkt.png","language":"Kotlin","readme":"datkt.flattree\n==============\n\nPort of @mafintosh's flat-tree functions to map a binary tree to a list.\n\n## Installation\n\nThe `datkt.flattree` package an be installed with NPM.\n\n```sh\n$ npm install @datkt/flat-tree\n```\n\n## Prerequisites\n\n- [Kotlin/Native](https://github.com/JetBrains/kotlin-native) and the\n  `konanc` command line program.\n- `@datkt/konanc-config`\n\n## Usage\n\n```sh\n## Compile a program in 'main.kt' and link flat-tree libraries found in `node_modules/`\n$ konanc main.kt $(konanc-config -clr @datkt/flat-tree) -o main.kexe\n$ ./main.kexe\n```\n\nwhere `main.kt` might be\n\n```kotlin\nimport datkt.flattree.*\n\nfun main(args: Array\u003cString\u003e) {\n  val tree = Tree()\n  tree.parent(0L, null) // 1L\n  tree.parent(2L, null) // 1L\n  tree.parent(1L, null) // 3L\n}\n```\n\n## API\n\n### `index = ftIndex(depth: Long, offset: Long): Long`\n\nReturns an array index for the tree element at the given depth and offset\n\n### `parentIndex = tree.parent(index: Long, depth: Long?): Long`\n\nReturns the index of the parent element in tree\n\n### `siblingIndex = tree.sibling(index: Long, depth: Long?): Long`\n\nReturns the index of this elements sibling\n\n### `children = tree.children(index: Long, depth: Long?): Array\u003cLong\u003e`\n\nReturns an array `[leftChild, rightChild]` with the indexes of this elements children.\nIf this element does not have any children it returns `null`\n\n### `range = tree.spans(index: Long, depth: Long?): Array\u003cLong\u003e`\n\nReturns the range (inclusive) the tree root at `index` spans.\nFor example `tree.spans(3)` would return `[0, 6]` (see the usage example).\n\n### `index = tree.leftSpan(index: Long, depth: Long?): Long`\n\nReturns the left spanning in index in the tree `index` spans.\n\n### `index = tree.rightSpan(index: Long, depth: Long?): Long`\n\nReturns the right spanning in index in the tree `index` spans.\n\n### `count = tree. count(index: Long, depth: Long?): Long`\n\nReturns how many nodes (including parent nodes) a tree contains\n\n### `depth = ftDepth(index: Long): Long`\n\nReturns the depth of an element\n\n### `offset = ftOffset(index: Long, depth: Long?): Long`\n\nReturns the relative offset of an element\n\n### `roots = tree.fullRoots(index: Long, result: Array\u003cLong\u003e?):  Array\u003cLong\u003e`\n\nReturns a list of all the full roots (subtrees where all nodes have either 2 or 0 children) `\u003c` index.\nFor example `fullRoots(8)` returns `[3]` since the subtree rooted at `3` spans `0 -\u003e 6` and the tree\nrooted at `7` has a child located at `9` which is `\u003e= 8`.\n\n### `index = iterator.next(): Long`\n\nMove the iterator the next item in the tree.\n\n### `index = iterator.prev(): Long`\n\nMove the iterator the prev item in the tree.\n\n### `iterator.seek(index: Long)`\n\nMove the iterator the this specific tree index.\n\n### `index = iterator.parent(): Long`\n\nMove the iterator to the current parent index\n\n### `index = iterator.leftChild(): Long`\n\nMove the iterator to the current left child index.\n\n### `index = iterator.rightChild(): Long`\n\nMove the iterator to the current right child index.\n\n### `index = iterator.leftSpan(): Long`\n\nMove the iterator to the current left span index.\n\n### `index = iterator.rightSpan(): Long`\n\nMove the iterator to the current right span index.\n\n### `bool = iterator.isLeft(): Boolean`\n\nIs the iterator at a left sibling?\n\n### `bool = iterator.isRight(): Boolean`\n\nIs the iterator at a right sibling?\n\n### `index = iterator.sibling(): Long`\n\nMove the iterator to the current sibling\n\n## See Also\n\n* https://github.com/mafintosh/flat-tree\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatkt%2Fflat-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatkt%2Fflat-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatkt%2Fflat-tree/lists"}