0.17.1 • Published 4 years ago

@rule.js/contextualize v0.17.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Rule.js: Contextualize

The idea behind this module is to allow to bind properties on every call done to a Rule object as though the property was present on every object you're testing against. This allows, for example, one to use the elasticsearch generator with user login data. For example:

const Rule = require('@rule.js/core').extend({
	contextualize: require('@rule.js/contextualize'),
	elasticsearch: require('@rule.js/elasticsearch')
})

const condition = Rule()
	.propEqual('user.name', 'creator')

const query = condition
	.contextualize({
		user: {
			name: 'foobar'
		}
	})
	.elasticsearch()

The query variable would then contain an elasticsearch query which looks like the following:

{
	"term": {
		"creator": "foobar"
	}
}
0.17.1

4 years ago

0.17.0

5 years ago

0.16.1

5 years ago

0.15.1

5 years ago

0.15.0

5 years ago

0.13.0

5 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago