express-sweet 1.0.31 → 1.0.33

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,6 +1,34 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [1.0.33] - 2023/7/1
5
+ - Added regular expression comparison view helper.
6
+ ```html
7
+ {{!-- results in: true --}}
8
+ {{regexMatch 'foobar' 'foo'}}
9
+
10
+ {{!-- results in: false --}}
11
+ {{regexMatch 'bar' 'foo'}}
12
+
13
+ {{!-- results in: false --}}
14
+ {{regexMatch 'foobar' '^foo$'}}
15
+
16
+ {{!-- results in: true --}}
17
+ {{regexMatch 'Visit Here' 'here' 'i'}}
18
+
19
+ {{!-- results in: false --}}
20
+ {{regexMatch 'Visit Here' 'here'}}
21
+
22
+ {{!-- results in: Match --}}
23
+ {{#if (regexMatch 'foobar' 'foo')}}
24
+ Match
25
+ {{/if}}
26
+ ```
27
+
28
+ ## [1.0.32] - 2023/7/1
29
+ ### Fixed
30
+ - Fixed a bug that cookies (req.cookies) cannot be referenced in the hook function before view rendering (config/view.js#beforeRender).
31
+
4
32
  ## [1.0.31] - 2023/6/29
5
33
  ### Changed
6
34
  - Changed helper function names in the view (Handlebars) from SnakeCase to CamelCase.
@@ -16,10 +44,12 @@ All notable changes to this project will be documented in this file.
16
44
  ### Added
17
45
  - Added view helper to convert numeric values to strings with language-sensitive representations.
18
46
  ```html
19
- {{number2locale 123456.789}} => 123,456.789
47
+ {{!-- results in: 123,456.789 --}}
48
+ {{number2locale 123456.789}}
20
49
 
21
50
  {{!-- German uses comma as decimal separator and period for thousands. --}}
22
- {{number2locale 123456.789 'de-DE'}} => 123.456,789
51
+ {{!-- results in: 123.456,789 --}}
52
+ {{number2locale 123456.789 'de-DE'}}
23
53
  ```
24
54
 
25
55
  ## [1.0.30] - 2023/6/26
@@ -123,10 +153,17 @@ All notable changes to this project will be documented in this file.
123
153
  ### Added
124
154
  - Added formatBytes view helper to convert bytes to appropriate units.
125
155
  ```html
126
- {{formatBytes 1024}} => 1 KB
127
- {{formatBytes 1234 2}} => 1.21 KB
128
- {{formatBytes 1234 3}} => 1.205 KB
129
- {{formatBytes 0}} => 0 Bytes
156
+ {{!-- results in: 1 KB --}}
157
+ {{formatBytes 1024}}
158
+
159
+ {{!-- results in: 1.21 KB --}}
160
+ {{formatBytes 1234 2}}
161
+
162
+ {{!-- results in: 1.205 KB --}}
163
+ {{formatBytes 1234 3}}
164
+
165
+ {{!-- results in: 0 Bytes --}}
166
+ {{formatBytes 0}}
130
167
  ```
131
168
 
132
169
  ## [1.0.24] - 2022/10/24
@@ -226,12 +263,12 @@ All notable changes to this project will be documented in this file.
226
263
  const collectionId = 'MyCollection';
227
264
 
228
265
  // Create a face and get the ID of the created face.
229
- // Output: e65d66cb-e7bc-4bbf-966c-b1b49ddf29f8
266
+ // results in: e65d66cb-e7bc-4bbf-966c-b1b49ddf29f8
230
267
  const faceId = await client.indexFace(collectionId, 'img/face4.jpg');
231
268
  console.log(faceId);
232
269
 
233
270
  // Create a face and get the details of the created face.
234
- // Output: {
271
+ // results in: {
235
272
  // faceId: '7f2dd321-f047-44ff-8856-864637e1d286',
236
273
  // ageRange: { high: 29, low: 21 },
237
274
  // gender: 'female',
@@ -268,7 +305,7 @@ All notable changes to this project will be documented in this file.
268
305
 
269
306
  (async () => {
270
307
  // Detects bounding boxes on faces.
271
- // Output: [
308
+ // results in: [
272
309
  // {
273
310
  // width: 0.3099822998046875,
274
311
  // height: 0.661512017250061,
@@ -280,7 +317,7 @@ All notable changes to this project will be documented in this file.
280
317
  console.log(res);
281
318
 
282
319
  // Detect facial details.
283
- // Output: [
320
+ // results in: [
284
321
  // {
285
322
  // boundingBox: {
286
323
  // width: 0.3099822998046875,
@@ -313,9 +350,14 @@ All notable changes to this project will be documented in this file.
313
350
  ### Added
314
351
  - Add date format helper to view.
315
352
  ```html
316
- {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}} => 2021/10/24
317
- {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}} => 2021/10/24
318
- {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}} => 2021/10/24
353
+ {{!-- results in: 2021/10/24 --}}
354
+ {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}}
355
+
356
+ {{!-- results in: 2021/10/24 --}}
357
+ {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}}
358
+
359
+ {{!-- results in: 2021/10/24 --}}
360
+ {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}}
319
361
  ```
320
362
 
321
363
  ## [1.0.18] - 2022/5/18
@@ -358,44 +400,40 @@ All notable changes to this project will be documented in this file.
358
400
  ### Changed
359
401
  - empty view helper can now check any type. Previously I could only check arrays.
360
402
  ```html
361
- // If the value is an array.
362
- let value = [5, 6];
363
- {{empty value}} => false
403
+ {{!-- results in: false --}}
404
+ {{empty [5, 6]}}
364
405
 
365
- {{#if (empty value)}}
406
+ {{#if (empty 'foo')}}
366
407
  Hello
367
408
  {{/if}}
368
409
 
369
- // If the value is a string.
370
- let value = 'Hello';
371
- {{empty value}} => false
410
+ {{!-- results in: false --}}
411
+ {{empty 'Hello'}}
372
412
 
373
- let value = '';
374
- {{empty value}} => true
413
+ {{!-- results in: true --}}
414
+ {{empty ''}}
375
415
 
376
- let value = ' ';
377
- {{empty value}} => true
416
+ {{!-- results in: true --}}
417
+ {{empty value}}
378
418
  ```
379
419
 
380
420
  - Added notEmpty view helper.
381
421
  ```html
382
- // If the value is an array.
383
- let value = [5, 6];
384
- {{notEmpty value}} => true
422
+ {{!-- results in: true --}}
423
+ {{notEmpty [5, 6]}}
385
424
 
386
- {{#if (notEmpty value)}}
425
+ {{#if (notEmpty 'foo')}}
387
426
  Hello
388
427
  {{/if}}
389
428
 
390
- // If the value is a string.
391
- let value = 'Hello';
392
- {{notEmpty value}} => true
429
+ {{!-- results in: true --}}
430
+ {{notEmpty 'Hello'}}
393
431
 
394
- let value = '';
395
- {{notEmpty value}} => false
432
+ {{!-- results in: false --}}
433
+ {{notEmpty ''}}
396
434
 
397
- let value = ' ';
398
- {{notEmpty value}} => false
435
+ {{!-- results in: false --}}
436
+ {{notEmpty ' '}}
399
437
  ```
400
438
 
401
439
  ## [1.0.13] - 2021/12/13
@@ -415,7 +453,7 @@ All notable changes to this project will be documented in this file.
415
453
  await transaction.commit();
416
454
 
417
455
  // Check the update result.
418
- // Output: New title of book: When Im Gone
456
+ // results in: New title of book: When Im Gone
419
457
  await book.reload();
420
458
  console.log(`New title of book: ${book.title}`);
421
459
  } catch (err) {
@@ -451,7 +489,7 @@ All notable changes to this project will be documented in this file.
451
489
  import * as sweet from 'express-sweet';
452
490
 
453
491
  // Find a face from the collection.
454
- // Output: Face search results: [
492
+ // results in: Face search results: [
455
493
  // {
456
494
  // faceId: '385e1b00-4ede-4219-a7b0-0b9cbe4953e5',
457
495
  // boundingBox: {
@@ -544,4 +582,6 @@ All notable changes to this project will be documented in this file.
544
582
  [1.0.28]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.27...v1.0.28
545
583
  [1.0.29]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.28...v1.0.29
546
584
  [1.0.30]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.29...v1.0.30
547
- [1.0.31]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.30...v1.0.31
585
+ [1.0.31]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.30...v1.0.31
586
+ [1.0.32]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.31...v1.0.32
587
+ [1.0.33]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.32...v1.0.33