Skip to content

Commit

Permalink
Export a default es6 module
Browse files Browse the repository at this point in the history
Fixes #33
  • Loading branch information
mfogel committed Aug 28, 2018
1 parent 09d7388 commit ac81217
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"presets": [["env"]]
"presets": ["env"],
"plugins": [
"add-module-exports"
]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ The Martinez-Rueda-Feito polygon clipping algorithm is used to compute the resul

### vNext (in development)

* Export a default es6 module ([#33](https://github.com/mfogel/polygon-clipping/issues/33))
* Allow self-crossing rings using [even-odd rule](https://en.wikipedia.org/wiki/Even%E2%80%93odd_rule) ([#30](https://github.com/mfogel/polygon-clipping/issues/30))
* Fix bug with nearly vertical segments being split ([#29](https://github.com/mfogel/polygon-clipping/issues/29))
* Fix bug with coincident segments being split slightly differently ([#22](https://github.com/mfogel/polygon-clipping/issues/22))
Expand Down
15 changes: 11 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import doIt from './src'
import operation from './src/operation'

export const union = (geom, ...moreGeoms) => {
const union = (geom, ...moreGeoms) => {
return doIt(operation.types.UNION, geom, moreGeoms)
}

export const intersection = (geom, ...moreGeoms) => {
const intersection = (geom, ...moreGeoms) => {
return doIt(operation.types.INTERSECTION, geom, moreGeoms)
}

export const xor = (geom, ...moreGeoms) => {
const xor = (geom, ...moreGeoms) => {
return doIt(operation.types.XOR, geom, moreGeoms)
}

export const difference = (subjectGeom, ...clippingGeoms) => {
const difference = (subjectGeom, ...clippingGeoms) => {
return doIt(operation.types.DIFFERENCE, subjectGeom, clippingGeoms)
}

export default {
union: union,
intersection: intersection,
xor: xor,
difference: difference,
}
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"webpack-dev-server": "^3.1.4"
},
"dependencies": {
"babel-plugin-add-module-exports": "^0.2.1",
"splaytree": "^2.0.2",
"tinyqueue": "^1.2.3"
}
Expand Down
2 changes: 1 addition & 1 deletion test/end-to-end.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import fs from 'fs'
import path from 'path'
import load from 'load-json-file'
import * as polygonClipping from '../main'
import polygonClipping from '../main'

/** USE ME TO RUN ONLY ONE TEST **/
const targetOnly = ''
Expand Down

0 comments on commit ac81217

Please sign in to comment.