Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mcollina/marry.js

Unification for JS
https://github.com/mcollina/marry.js

Last synced: 13 days ago
JSON representation

Unification for JS

Awesome Lists containing this project

README

        

Marry
=====

Unification for JS: extract variables from your JS objects.

```js

var marry = require('marry')

console.log('first, basic marrying')
console.log(marry({
long: {
object: 42
}
, answer: 42
, something: 'else'
, beep: 'bop'
}, {
long: {
object: marry.v('long')
}
, answer: marry.v('answer')
, something: 'else'
}))
// outputs
// { bindings: { long: 42, answer: 42 },
// marriage: { long: { object: 42 }, answer: 42, something: 'else' },
// equalVariables: {} }

console.log('second, variables marrying')
console.log(marry({
another: marry.v('another')
, answer: 42
, something: 'else'
, beep: 'bop'
}, {
another: marry.v('var')
, answer: marry.v('answer')
, something: 'else'
}))
// outputs
// { bindings: { answer: 42 },
// marriage: { another: { name: 'var' }, answer: 42, something: 'else' },
// equalVariables: { var: [ 'another' ], another: [ 'var' ] } }
```

License
-------

MIT