csp.js
csp.js copied to clipboard
would you be open to some code updates?
@njoubert some things I'd like to do:
- update to es modules
- update to es6 (let, const, etc.)
- simplify the API
Would you be open to some pull request(s) for this stuff? Happy to work on it.
Sure, that would be great!
@njoubert here's what I've come up with so far:
https://gist.github.com/mreinstein/fe6c19caace8921666ab4d24bf7ed0a0
changes:
- converted to pure es modules
- made the interface pure functions
- removed the abstraction layer stuff for adding more solver types (there's only ever been 1 in this repo so far)
- converted to es6 (
let
,const
,...
object spread syntax)
Let me know if this is something you like, happy to send this in a proper PR
another thing I've considered doing (but haven't yet) is using objects for semi-named parameters. For example this:
addConstraint({
problem: p,
variables: [ 'a', 'b' ],
fn: (a, b) => a*2 === b
})
is probably more readable than:
addConstraint(
p,
[ 'a', 'b' ],
(a, b) => a*2 === b
)
If this is something you like, happy to add this change as well.
@njoubert any thoughts on these changes? Happy to turn this into a PR if you generally agree with the concept.
@mreinstein Your changes look good for me. I think a PR makes it easier to discuss changes
I'm happy to send a PR, was just hoping to hear from the project maintainer if this is something that would even be considered