1.1.0 • Published 8 years ago

@rill/set v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Simple utility to set a local variable using a middleware.

Installation

npm install @rill/set

Example

const app = require('rill')()

// Set a local variable for each request.
// Uses the same setter as the query string parser
app.use(set("a", 1))
app.use(set("b[]", 1))
app.use(set("c[d]", 1))


app.use(({ locals })=> {
	locals //-> {
		a: 1,
		b: [1],
		c: { d: 1 }
	}
})

Contributions

  • Use npm test to run tests.

Please feel free to create a PR!

1.1.0

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago