Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Commit c0f931a

Browse files
committed
Re-add UMD stuff and bump version to 1.1.0
1 parent 504ef5c commit c0f931a

File tree

7 files changed

+43
-18
lines changed

7 files changed

+43
-18
lines changed

.eslintrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ env:
22
browser: true
33
es6: true
44
extends: 'eslint:recommended'
5+
globals:
6+
define: true
7+
module: true
58
rules:
69
indent:
710
- error

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
# CashCash
22

3+
**A very small DOM library inspired by [jQuery](https://jquery.com) that smooths over some of the rough edges in JavaScript's native DOM querying methods.**
4+
35
[![npm](https://img.shields.io/npm/v/@jgarber/cashcash.svg?style=for-the-badge)](https://www.npmjs.com/package/@jgarber/cashcash)
46
[![Bower](https://img.shields.io/bower/v/cashcash.svg?style=for-the-badge)](https://bower.io/search/?q=cashcash)
57
[![Downloads](https://img.shields.io/npm/dt/@jgarber/cashcash.svg?style=for-the-badge)](https://www.npmjs.com/package/@jgarber/cashcash)
68
[![Build](https://img.shields.io/travis/jgarber623/CashCash.svg?style=for-the-badge)](https://travis-ci.org/jgarber623/CashCash)
79
[![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/CashCash.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/CashCash)
810
[![Coverage](https://img.shields.io/codeclimate/coverage/jgarber623/CashCash.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/CashCash)
911

10-
CashCash is a very small DOM library inspired by [jQuery](https://jquery.com). The project's primary goal is to smooth over some of the rough edges in JavaScript's native DOM querying methods.
11-
1212
### Key Features
1313

1414
- Uses JavaScript's native [querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) method
1515
- Dependency-free
16+
- AMD/Node module support
1617

1718
CashCash is also really tiny:
1819

1920
<table>
2021
<tbody>
2122
<tr>
2223
<th>Uncompressed</th>
23-
<td>1,226 bytes</td>
24+
<td>1,429 bytes</td>
2425
</tr>
2526
<tr>
2627
<th>Minified</th>
27-
<td>750 bytes</td>
28+
<td>888 bytes</td>
2829
</tr>
2930
<tr>
3031
<th>Minified and gzipped</th>
31-
<td>465 bytes</td>
32+
<td>523 bytes</td>
3233
</tr>
3334
</tbody>
3435
</table>
3536

36-
3737
## Getting CashCash
3838

3939
You've got a couple options for adding CashCash to your project:
4040

41-
- [Download a tagged version](https://github.com/jgarber623/CashCash/tags) from GitHub and do it yourself (old school).
41+
- [Download a tagged version](https://github.com/jgarber623/CashCash/tags) from GitHub and do it yourself _(old school)_.
4242
- Install using [npm](https://www.npmjs.com/package/@jgarber/cashcash): `npm install @jgarber/cashcash --save`
4343
- Install using [Yarn](https://yarnpkg.com/en/package/@jgarber/cashcash): `yarn add @jgarber/cashcash`
4444
- Install using [Bower](https://bower.io/search/?q=cashcash): `bower install cashcash --save`
@@ -137,6 +137,10 @@ var container = CashCash('#container');
137137
console.log(CashCash('p', container[0]).context); // logs a reference to `<div id="container">`
138138
```
139139

140+
### Example
141+
142+
For a full-featured CashCash demonstration, check out [the included example file](https://github.com/jgarber623/CashCash/blob/master/example/index.html).
143+
140144
## Tips and Tricks
141145

142146
### Mimicking jQuery

bower.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cashcash",
33
"description": "A very small DOM library inspired by jQuery.",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"main": "dist/cashcash.js",
66
"moduleType": [
77
"globals"
@@ -17,8 +17,11 @@
1717
],
1818
"keywords": [
1919
"dom",
20+
"dom-library",
21+
"dom-selection",
2022
"javascript",
21-
"queryselector"
23+
"jquery",
24+
"queryselectorall"
2225
],
2326
"authors": [
2427
{

dist/cashcash.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* CashCash 1.0.0
2+
* CashCash 1.1.0
33
*
44
* A very small DOM library inspired by jQuery.
55
*
@@ -11,8 +11,14 @@
1111
*/
1212

1313
(function(root, factory) {
14-
root.CashCash = factory(root.document);
15-
})(this, function(document) {
14+
if (typeof define === "function" && define.amd) {
15+
define([], factory);
16+
} else if (typeof module === "object" && module.exports) {
17+
module.exports = factory();
18+
} else {
19+
root.CashCash = factory();
20+
}
21+
})(typeof self !== "undefined" ? self : this, function() {
1622
"use strict";
1723
var Cash = function(selector, context) {
1824
selector = typeof selector === "string" ? selector.trim() : "";

dist/cashcash.min.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* CashCash 1.0.0
2+
* CashCash 1.1.0
33
*
44
* A very small DOM library inspired by jQuery.
55
*
@@ -10,4 +10,4 @@
1010
* CashCash may be freely distributed under the MIT license.
1111
*/
1212

13-
!function(t,e){t.CashCash=function(t){"use strict";var e=function(e,n){if(e="string"==typeof e?e.trim():"",e.length){e="string"==typeof n&&n.trim().length?n.trim()+" "+e:e,n=n instanceof HTMLElement?n:t;var r=n.querySelectorAll(e),i=r.length;for(this.length=i,this.context=n,this.selector=e;i--;)this[i]=r[i]}},n=function(t,n){return new e(t,n)};return e.prototype=n.prototype={length:0,toArray:function(){return Array.prototype.slice.call(this)}},n}(t.document)}(this);
13+
!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():t.CashCash=e()}("undefined"!=typeof self?self:this,function(){"use strict";var t=function(t,e){if(t="string"==typeof t?t.trim():"",t.length){t="string"==typeof e&&e.trim().length?e.trim()+" "+t:t,e=e instanceof HTMLElement?e:document;var n=e.querySelectorAll(t),o=n.length;for(this.length=o,this.context=e,this.selector=t;o--;)this[o]=n[o]}},e=function(e,n){return new t(e,n)};return t.prototype=e.prototype={length:0,toArray:function(){return Array.prototype.slice.call(this)}},e});

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
"name": "@jgarber/cashcash",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "A very small DOM library inspired by jQuery.",
55
"keywords": [
66
"dom",
7+
"dom-library",
8+
"dom-selection",
79
"javascript",
8-
"queryselector"
10+
"jquery",
11+
"queryselectorall"
912
],
1013
"homepage": "https://github.com/jgarber623/CashCash",
1114
"bugs": {

src/cashcash.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
(function(root, factory) {
2-
root.CashCash = factory(root.document);
3-
}(this, function(document) {
2+
if (typeof define === 'function' && define.amd) {
3+
define([], factory);
4+
} else if (typeof module === 'object' && module.exports) {
5+
module.exports = factory();
6+
} else {
7+
root.CashCash = factory();
8+
}
9+
}(typeof self !== 'undefined' ? self : this, function() {
410
'use strict';
511

612
var Cash = function(selector, context) {

0 commit comments

Comments
 (0)