Skip to content

Commit 87a45eb

Browse files
Bumped version to 4.1.3
1 parent cddb5aa commit 87a45eb

8 files changed

Lines changed: 33 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### Version 4.1.3
2+
- Ensuring Cash can be bundled correctly via WebPack
3+
- $.fn.toggle: ensuring each element is toggled independently
4+
- TypeScript: ensuring some useful internal types are exported
5+
- TypeScript: made types a little more forgiving
6+
17
### Version 4.1.2
28
- Avoiding publishing unnecessary files to NPM
39

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ If you're migrating from jQuery be sure to read our [migration guide](https://gi
3030

3131
## Usage
3232

33-
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.2/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@4.1.2/dist/cash.min.js) and use it like this:
33+
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.3/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@4.1.3/dist/cash.min.js) and use it like this:
3434

3535
```html
36-
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.2/cash.min.js"></script>
36+
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.3/cash.min.js"></script>
3737
<script>
3838
$(function () {
3939
$('html').addClass ( 'dom-loaded' );

dist/cash.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
interface Cash {
2-
[index: number]: EleAll;
2+
[index: number]: EleLoose;
33
length: number;
44
splice(start: number, deleteCount?: number): Ele[];
55
splice(start: number, deleteCount: number, ...items: Ele[]): Ele[];
@@ -12,7 +12,7 @@ declare type plainObject = {
1212
};
1313
declare type falsy = undefined | null | false | 0 | '';
1414
declare type Ele = Window | Document | HTMLElement | Element | Node;
15-
declare type EleAll = Window & Document & HTMLElement & Element & Node;
15+
declare type EleLoose = Window & Document & HTMLElement & Element & Node;
1616
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
1717
declare type Comparator = string | Ele | Cash | ((this: Ele, index: number, ele: Ele) => boolean);
1818
declare type Context = Document | HTMLElement | Element;
@@ -40,7 +40,7 @@ interface Cash {
4040
}
4141
declare type MapCallback<T> = (this: T, index: number, ele: T) => Ele;
4242
interface Cash {
43-
map(callback: MapCallback<Ele>): Cash;
43+
map(callback: MapCallback<EleLoose>): Cash;
4444
}
4545
interface Cash {
4646
slice(start?: number, end?: number): Cash;
@@ -53,7 +53,7 @@ interface CashStatic {
5353
each<T>(arr: ArrayLike<T>, callback: EachCallback<T>): void;
5454
}
5555
interface Cash {
56-
each(callback: EachCallback<Ele>): this;
56+
each(callback: EachCallback<EleLoose>): this;
5757
}
5858
interface Cash {
5959
removeProp(prop: string): this;
@@ -304,3 +304,4 @@ interface Cash {
304304
siblings(comparator?: Comparator): Cash;
305305
}
306306
export default cash;
307+
export { Cash, Ele as Element, Selector, Comparator, Context };

dist/cash.esm.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ function isHidden(ele) {
462462
}
463463
Cash.prototype.toggle = function (force) {
464464
return this.each((i, ele) => {
465-
force = force !== undefined ? force : isHidden(ele);
466-
if (force) {
465+
const show = force !== undefined ? force : isHidden(ele);
466+
if (show) {
467467
ele.style.display = '';
468468
if (isHidden(ele)) {
469469
ele.style.display = getDefaultDisplay(ele.tagName);
@@ -1015,4 +1015,5 @@ Cash.prototype.siblings = function (comparator) {
10151015
// @priority -100
10161016
// @require ./cash.ts
10171017
export default cash;
1018+
export { Cash };
10181019

dist/cash.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,9 @@ function isHidden(ele) {
574574

575575
Cash.prototype.toggle = function (force) {
576576
return this.each(function (i, ele) {
577-
force = force !== undefined ? force : isHidden(ele);
577+
var show = force !== undefined ? force : isHidden(ele);
578578

579-
if (force) {
579+
if (show) {
580580
ele.style.display = '';
581581

582582
if (isHidden(ele)) {

dist/cash.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cash.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11

22
interface Cash {
3-
[index: number]: EleAll;
4-
length: number;
5-
splice ( start: number, deleteCount?: number ): Ele[];
6-
splice ( start: number, deleteCount: number, ...items: Ele[] ): Ele[];
3+
[index: number]: EleLoose,
4+
length: number,
5+
splice ( start: number, deleteCount?: number ): Ele[],
6+
splice ( start: number, deleteCount: number, ...items: Ele[] ): Ele[]
77
}
88

99
interface CashStatic {
10-
fn: Cash;
10+
fn: Cash
1111
}
1212

1313
type plainObject = { [index: string]: any };
1414
type falsy = undefined | null | false | 0 | '';
1515

1616
type Ele = Window | Document | HTMLElement | Element | Node;
17-
type EleAll = Window & Document & HTMLElement & Element & Node; //UGLY: Trick to remove some kind-of useless type errors //URL: https://github.com/kenwheeler/cash/issues/278
17+
type EleLoose = Window & Document & HTMLElement & Element & Node; //UGLY: Trick to remove some kind-of useless type errors //URL: https://github.com/kenwheeler/cash/issues/278
1818
type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
1919
type Comparator = string | Ele | Cash | (( this: Ele, index: number, ele: Ele ) => boolean);
2020
type Context = Document | HTMLElement | Element;
@@ -173,10 +173,10 @@ Cash.prototype.last = function ( this: Cash ) {
173173
type MapCallback<T> = ( this: T, index: number, ele: T ) => Ele;
174174

175175
interface Cash {
176-
map ( callback: MapCallback<Ele> ): Cash;
176+
map ( callback: MapCallback<EleLoose> ): Cash;
177177
}
178178

179-
Cash.prototype.map = function ( this: Cash, callback: MapCallback<Ele> ) {
179+
Cash.prototype.map = function ( this: Cash, callback: MapCallback<EleLoose> ) {
180180
return cash ( map.call ( this, ( ele: Ele, i: number ) => callback.call ( ele, i, ele ) ) );
181181
};
182182

@@ -237,10 +237,10 @@ cash.each = each;
237237
// @require core/each.ts
238238

239239
interface Cash {
240-
each ( callback: EachCallback<Ele> ): this;
240+
each ( callback: EachCallback<EleLoose> ): this;
241241
}
242242

243-
Cash.prototype.each = function ( this: Cash, callback: EachCallback<Ele> ) {
243+
Cash.prototype.each = function ( this: Cash, callback: EachCallback<EleLoose> ) {
244244
each ( this, callback );
245245
return this;
246246
};
@@ -1074,9 +1074,9 @@ Cash.prototype.toggle = function ( this: Cash, force?: boolean ) {
10741074

10751075
return this.each ( ( i, ele ) => {
10761076

1077-
force = force !== undefined ? force : isHidden ( ele );
1077+
const show = force !== undefined ? force : isHidden ( ele );
10781078

1079-
if ( force ) {
1079+
if ( show ) {
10801080

10811081
ele.style.display = '';
10821082

@@ -2517,3 +2517,4 @@ Cash.prototype.siblings = function ( this: Cash, comparator?: Comparator ) {
25172517
// @require ./cash.ts
25182518

25192519
export default cash;
2520+
export { Cash, Ele as Element, Selector, Comparator, Context };

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cash-dom",
33
"description": "An absurdly small jQuery alternative for modern browsers.",
4-
"version": "4.1.2",
4+
"version": "4.1.3",
55
"license": "MIT",
66
"browser": "./dist/cash.js",
77
"main": "./dist/cash.js",

0 commit comments

Comments
 (0)