express-sweet 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,8 +1,28 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [2.0.6] - 2025/2/9
5
+ ### Fixed
6
+ - Fixed a bug that caused redirection to fail when a path with query parameters was set for the logout redirect URL (`failure_redirect` in `config/authentication.js`).
7
+
8
+ ## [2.0.5] - 2025/2/4
9
+ ### Added
10
+ - Added a Handlebars helper, available for use in views, to replace HTML tags in a string.
11
+
12
+ Example:
13
+
14
+ ```html
15
+ {{!-- results in: lorem ipsum dolor sit amet --}}
16
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>'}}}
17
+
18
+ {{!-- results in: lorem ipsum <strong>dolor</strong> sit amet --}}
19
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' '<strong>' ''}}}
20
+
21
+ {{!-- results in: 🍩lorem ipsum 🍩dolor🍩 🍩sit🍩 amet🍩 --}}
22
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' [] '🍩'}}}
23
+ ```
24
+
4
25
  ## [2.0.4] - 2025/1/14
5
- <!-- ## [2.0.4] - Unreleased -->
6
26
  ### Changed
7
27
  - Refactored variable names.
8
28
  - Fix Docker demo.
@@ -11,6 +31,9 @@ All notable changes to this project will be documented in this file.
11
31
 
12
32
  ### Added
13
33
  - **`findObjectInArray` Handlebars helper:** This helper is added to the view, allowing you to find an object in an array based on a specified field name and value.
34
+
35
+ Example:
36
+
14
37
  ```html
15
38
  {{!--
16
39
  items is an array of objects: [{id: 123, name: 'Item A'}, {id: 456, name: 'Item B'}]
@@ -468,4 +491,6 @@ All notable changes to this project will be documented in this file.
468
491
  [2.0.1]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.0...v2.0.1
469
492
  [2.0.2]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.1...v2.0.2
470
493
  [2.0.3]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.2...v2.0.3
471
- [2.0.4]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.3...v2.0.4
494
+ [2.0.4]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.3...v2.0.4
495
+ [2.0.5]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.4...v2.0.5
496
+ [2.0.6]: https://github.com/takuya-motoshima/express-sweet/compare/v2.0.5...v2.0.6
package/README.md CHANGED
@@ -842,6 +842,31 @@ There are three ways to use a layout, listed in precedence order.
842
842
  {{cacheBusting '/assets/style.css' '//example.com'}}
843
843
  ```
844
844
 
845
+ - `stripTags()`
846
+ Removes HTML tags from a string, optionally allowing specific tags.
847
+
848
+ **Parameters:**
849
+ - str: string
850
+ The string to remove HTML tags from.
851
+ - allowedTags: string|string[]
852
+ An array of allowed HTML tags. Default is an empty array.
853
+ - replacement: string
854
+ The string to replace HTML tags with. Default is blank.
855
+
856
+ **Return:**
857
+ `string` The string with HTML tags removed.
858
+
859
+ ```js
860
+ {{!-- results in: lorem ipsum dolor sit amet --}}
861
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>'}}}
862
+
863
+ {{!-- results in: lorem ipsum <strong>dolor</strong> sit amet --}}
864
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' '<strong>' ''}}}
865
+
866
+ {{!-- results in: 🍩lorem ipsum 🍩dolor🍩 🍩sit🍩 amet🍩 --}}
867
+ {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' [] '🍩'}}}
868
+ ```
869
+
845
870
  #### Object Helper
846
871
  - `jsonStringify()`
847
872
  Stringify an object using JSON.stringify.
@@ -1642,10 +1667,12 @@ See [here](https://sequelize.org/api/v6/class/src/model.js~model) for more infor
1642
1667
  // ]
1643
1668
  await UserModel.findAll({
1644
1669
  attributes: ['id', 'name'],
1645
- include: [{
1646
- association: 'profile',
1647
- attributes: ['userId', 'address', 'tel']
1648
- }]
1670
+ include: [
1671
+ {
1672
+ association: 'profile',
1673
+ attributes: ['userId', 'address', 'tel']
1674
+ },
1675
+ ]
1649
1676
  });
1650
1677
  ```
1651
1678
  - `public static belongsTo()`