olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.96k stars 548 forks source link

Support for require.js (AMD) and avoiding global scope #72

Closed selfawaresoup closed 10 years ago

selfawaresoup commented 10 years ago

So far, Lunr supports module.exports for node.js but not AMD style loading like with require.js.

It also by default creates a global variable lunr even when loaded as a module.

Wrapping the lib in a function(){}, detecting the presence of defineor exports and only using a global variable as a fallback, this can be resolved.