├── .bmp.yml ├── .gitignore ├── .gitignore-dist ├── Gruntfile.coffee ├── LICENSE ├── README.md ├── dev-tools ├── distribute ├── gh-pages └── push-to-master ├── index.coffee ├── index.js ├── package.json ├── spec └── lib │ ├── interval-tree.coffee │ ├── interval.coffee │ ├── node.coffee │ ├── sorted-list.coffee │ └── util.coffee └── src ├── lib ├── interval-tree.coffee ├── interval.coffee ├── node.coffee ├── point.coffee ├── sorted-list.coffee └── util.coffee └── web-entry.coffee /.bmp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.1.0 3 | files: 4 | package.json: '"version": "%.%.%",' 5 | Gruntfile.coffee: currentVersion = 'v%.%.%' 6 | dev-tools/distribute: VERSION="%.%.%" 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.csv 2 | *.dat 3 | *.iml 4 | *.log 5 | *.out 6 | *.pid 7 | *.seed 8 | *.sublime-* 9 | *.swo 10 | *.swp 11 | *.tgz 12 | *.xml 13 | .DS_Store 14 | .idea 15 | .project 16 | .strong-pm 17 | coverage 18 | node_modules 19 | npm-debug.log 20 | dist 21 | bower_components 22 | doc 23 | -------------------------------------------------------------------------------- /.gitignore-dist: -------------------------------------------------------------------------------- 1 | *.csv 2 | *.dat 3 | *.iml 4 | *.log 5 | *.out 6 | *.pid 7 | *.seed 8 | *.sublime-* 9 | *.swo 10 | *.swp 11 | *.tgz 12 | *.xml 13 | .DS_Store 14 | .idea 15 | .project 16 | .strong-pm 17 | coverage 18 | node_modules 19 | npm-debug.log 20 | -------------------------------------------------------------------------------- /Gruntfile.coffee: -------------------------------------------------------------------------------- 1 | currentVersion = 'v1.1.0' 2 | module.exports = (grunt) -> 3 | 4 | grunt.config.init 5 | 6 | 'mocha-chai-sinon': 7 | spec: 8 | src: [ 9 | 'spec/lib/*.coffee' 10 | ] 11 | options: 12 | ui: 'bdd' 13 | reporter: 'spec' 14 | require: 'coffee-script/register' 15 | 16 | single: 17 | src: [ 18 | grunt.option('file') ? 'spec/lib/interval-tree.coffee' 19 | ] 20 | options: 21 | ui: 'bdd' 22 | reporter: 'spec' 23 | require: 'coffee-script/register' 24 | 25 | 26 | yuidoc: 27 | options: 28 | paths: ['src'] 29 | syntaxtype: 'coffee' 30 | extension: '.coffee' 31 | master: 32 | options: 33 | outdir: 'doc' 34 | 35 | 36 | coffee: 37 | dist: 38 | expand: true 39 | cwd: 'src/lib' 40 | src: ['**/*.coffee'] 41 | dest: 'dist/lib/' 42 | ext: '.js' 43 | extDot: 'first' 44 | options: 45 | bare: true 46 | 47 | 48 | 49 | grunt.registerTask 'web', -> 50 | done = @async() 51 | browserify = require('browserify') 52 | 53 | b = browserify './src/web-entry.coffee', 54 | extensions: '.coffee' 55 | 56 | b.transform('coffeeify') 57 | 58 | b.bundle (err, buf) -> 59 | require('fs').writeFileSync 'dist/interval-tree.js', buf.toString() 60 | done() 61 | 62 | 63 | grunt.loadNpmTasks 'grunt-mocha-chai-sinon' 64 | grunt.loadNpmTasks 'grunt-contrib-yuidoc' 65 | grunt.loadNpmTasks 'grunt-contrib-coffee' 66 | 67 | grunt.registerTask 'default', 'mocha-chai-sinon:spec' 68 | grunt.registerTask 'single', 'mocha-chai-sinon:single' 69 | grunt.registerTask 'build', ['coffee:dist'] 70 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2015 SHIN Suzuki 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Circle CI](https://circleci.com/gh/shinout/interval-tree2.svg?style=svg)](https://circleci.com/gh/shinout/interval-tree2) 2 | 3 | # interval-tree2 4 | 5 | interval tree in JavaScript (source is written in CoffeeScript) 6 | 7 | improves previous [interval-tree](https://github.com/shinout/interval-tree) 8 | 9 | more maintenanceability with [CoffeeScript](http://coffeescript.org/) OOP. 10 | 11 | more robustness with [mocha](http://mochajs.org), [CircleCI](https://circleci.com/gh/shinout/interval-tree2) 12 | 13 | 14 | ## API Documentation 15 | 16 | [latest API documentation Page (YUIDoc)](http://shinout.github.io/interval-tree2/doc/index.html) 17 | 18 | 19 | ## installation 20 | 21 | ```bash 22 | $ npm install interval-tree2 23 | ``` 24 | 25 | ## usage 26 | 27 | ### require 28 | 29 | ```js 30 | 31 | var IntervalTree = require('interval-tree2'); 32 | ``` 33 | 34 | when using in web, use `dist/interval-tree.js` in this module. 35 | 36 | ```html 37 |