File tree 3 files changed +38
-19
lines changed
3 files changed +38
-19
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ A lightweight (~3KB minified) library that combines the power of jQuery-like DOM
6
6
## Installation
7
7
8
8
``` bash
9
- npm install _query-js
9
+ npm install underquery
10
10
```
11
11
12
12
## Core Usage
@@ -37,7 +37,15 @@ _('.button')
37
37
38
38
### ES6 Module
39
39
``` javascript
40
- import _ from ' _query-js' ;
40
+
41
+ // ES6 import
42
+ import _ from ' underquery' ;
43
+
44
+ // CommonJS require
45
+ const _ = require (' underquery' );
46
+
47
+ // Browser script tag
48
+ < script src= " node_modules/underquery/dist/_query.min.js" >< / script>
41
49
```
42
50
43
51
## Quick Examples
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " underquery" ,
3
- "version" : " 1.0.1 " ,
3
+ "version" : " 1.0.2 " ,
4
4
"description" : " A lightweight jQuery + Underscore inspired library for DOM manipulation and collection handling" ,
5
5
"main" : " dist/_query.min.js" ,
6
- "module" : " src/_query.js" ,
6
+ "module" : " dist/_query.js" ,
7
+ "exports" : {
8
+ "." : {
9
+ "import" : " ./dist/_query.js" ,
10
+ "require" : " ./dist/_query.min.js"
11
+ }
12
+ },
7
13
"files" : [
8
14
" dist" ,
9
15
" README.md"
10
16
],
11
17
"scripts" : {
18
+ "build" : " mkdir -p dist && cp src/_query.js dist/ && cp src/_query.min.js dist/" ,
19
+ "prepublishOnly" : " npm run build"
12
20
},
13
21
"keywords" : [
14
22
" dom" ,
21
29
" lightweight"
22
30
],
23
31
"author" :
" Your Name <[email protected] >" ,
24
- "license" : " MIT" ,
25
- "repository" : {
26
- "type" : " git" ,
27
- "url" : " git+https://github.com/metacritical/_Q"
28
- },
29
- "bugs" : {
30
- "url" : " https://github.com/metacritical/_Q/issues"
31
- },
32
- "homepage" : " https://github.com/metacritical/_Q#readme"
32
+ "license" : " MIT"
33
33
}
Original file line number Diff line number Diff line change 1
- constructor ( ) {
2
-
3
- } _ = ( function ( ) {
1
+ const _ = ( function ( ) {
4
2
/**
5
3
* Main Query constructor function
6
4
* @param {string|array|object } input - Input selector string, array or object
@@ -268,9 +266,22 @@ constructor() {
268
266
Q . VERSION = '1.0.0' ;
269
267
Q . NAME = '_Query' ;
270
268
271
- //_ and _Q globally callable fn.
272
- window . _ = Q ;
273
- window . _Q = Q ;
269
+ //_ and _Q globally
270
+ // window._ = Q;
271
+ // window._Q = Q;
274
272
275
273
return Q ;
276
274
} ) ( ) ;
275
+
276
+
277
+ // ES6 module Export support.
278
+ if ( typeof module !== 'undefined' && module . exports ) {
279
+ module . exports = Q ;
280
+ } else if ( typeof define === 'function' && define . amd ) {
281
+ define ( function ( ) { return Q ; } ) ;
282
+ } else if ( typeof window !== 'undefined' ) {
283
+ window . _ = Q ;
284
+ window . _Q = Q ;
285
+ }
286
+
287
+ export default Q ;
You can’t perform that action at this time.
0 commit comments