Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flat-tree

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flat-tree - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

.github/workflows/test-node.yml

12

index.js

@@ -141,9 +141,17 @@ exports.fullRoots = function (index, result) {

Iterator.prototype.isLeft = function () {
return !(this.offset & 1)
return (this.offset & 1) === 0
}
Iterator.prototype.isRight = function () {
return !this.isLeft()
return (this.offset & 1) === 1
}
Iterator.prototype.contains = function (index) {
return index > this.index
? index < (this.index + this.factor / 2)
: index < this.index
? index > (this.index - this.factor / 2)
: true
}
Iterator.prototype.prev = function () {

@@ -150,0 +158,0 @@ if (!this.offset) return this.index

6

package.json
{
"name": "flat-tree",
"version": "1.6.0",
"version": "1.7.0",
"description": "A series of functions to map a binary tree to a list",

@@ -8,4 +8,4 @@ "main": "index.js",

"devDependencies": {
"standard": "^8.6.0",
"tape": "^4.0.0"
"standard": "^14.3.4",
"tape": "^5.0.1"
},

@@ -12,0 +12,0 @@ "scripts": {

@@ -96,3 +96,3 @@ # flat-tree

#### `index = iterator.prev()
#### `index = iterator.prev()`

@@ -137,4 +137,21 @@ Move the iterator the prev item in the tree.

## See also
- [mafintosh/print-flat-tree][print]: A cli that can pretty print flat-trees.
- [bcomnes/flattree][ftg]: A port of the node module to Go.
- [arablocks/flat-tree.c](c): A port of the module to C
- [datkt/flat-tree][kt]: A port of the module to Kotlin
- [datrs/flat-tree][rs]: A port to Rust.
- [bcomnes/flattree][ftg]: A port to Go.
- [noffle/cl-flat-tree][clft]: A port to Common Lisp.
## License
MIT
[print]: https://github.com/mafintosh/print-flat-tree
[rs]: https://github.com/datrs/flat-tree
[ftg]: https://github.com/bcomnes/flattree
[c]: https://github.com/arablocks/flat-tree.c
[kt]: https://github.com/datkt/flat-tree
[clft]: https://github.com/noffle/cl-flat-tree

@@ -27,2 +27,3 @@ var tape = require('tape')

t.same(feed.children(3), [1, 5])
t.same(feed.children(9), [8, 10])
t.end()

@@ -147,1 +148,15 @@ })

})
tape('iterator, non-leaf start', function (t) {
var iterator = feed.iterator(1)
t.same(iterator.index, 1)
t.same(iterator.parent(), 3)
t.same(iterator.parent(), 7)
t.same(iterator.rightChild(), 11)
t.same(iterator.leftChild(), 9)
t.same(iterator.next(), 13)
t.same(iterator.leftSpan(), 12)
t.end()
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc