express-sweet 1.0.18 → 1.0.19

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/docs/index.html CHANGED
@@ -65,6 +65,7 @@
65
65
  <a class="nav-link" href="#views-html-helpers">HTML helpers</a>
66
66
  <a class="nav-link" href="#views-object-helpers">Object helpers</a>
67
67
  <a class="nav-link" href="#views-string-helpers">String helpers</a>
68
+ <a class="nav-link" href="#views-date-helpers">Date helpers</a>
68
69
  </nav>
69
70
  <a class="nav-link" href="#model">Model</a>
70
71
  <nav class="nav nav-pills flex-column flex-nowrap fw-normal small">
@@ -111,7 +112,7 @@
111
112
  </div>
112
113
  <hr class="mx-auto mx-lg-0 my-5">
113
114
  <p class="text-muted">
114
- Currently <a href="https://github.com/takuya-motoshima/express-sweet/releases/tag/v1.0.18" target="_blank">v1.0.18</a>
115
+ Currently <a href="https://github.com/takuya-motoshima/express-sweet/releases/tag/v1.0.19" target="_blank">v1.0.19</a>
115
116
  <span class="px-1">•</span>
116
117
  <a href="#quick-start">Quick Start</a>
117
118
  <span class="px-1">•</span>
@@ -1303,6 +1304,37 @@ let val = &#039;2&#039;
1303
1304
  </tr>
1304
1305
  </tbody>
1305
1306
  </table>
1307
+ <h2 id="views-date-helpers">Date helpers</h2>
1308
+ <table class="table">
1309
+ <thead class="table-light">
1310
+ <tr class="text-nowrap">
1311
+ <th>Helper</th>
1312
+ <th>Description</th>
1313
+ </tr>
1314
+ </thead>
1315
+ <tbody>
1316
+ <tr>
1317
+ <td class="text-nowrap"><code class="h5">format_date</code></td>
1318
+ <td class="w-100">
1319
+ <p>Use moment to format the date.</p>
1320
+ <h6>Parameters</h6>
1321
+ <ul>
1322
+ <li><code>string</code> format A format string based on moment.</li>
1323
+ <li><code>string</code> date Date string to format.</li>
1324
+ <li><code>string|string[]</code> locale Language or language-country locale string (or array of strings) available in <a href="https://github.com/moment/moment/tree/develop/locale" target="_blank">https://github.com/moment/moment/tree/develop/locale</a>.</li>
1325
+ </ul>
1326
+ <h6>Return value</h6>
1327
+ <p><code>string</code> Returns formatted date.</p>
1328
+ <h6>Usage:</h6>
1329
+ <div class="highlight">
1330
+ <pre><code class="html">{{format_date &#039;YYYY/MM/DD&#039; &quot;2021-10-24T02:13:06.610Z&quot;}} =&gt; 2021/10/24
1331
+ {{format_date &#039;YYYY/MM/DD&#039; &quot;2021-10-24T02:13:06.610Z&quot; &#039;jp&#039;}} =&gt; 2021/10/24
1332
+ {{format_date &#039;YYYY/MM/DD&#039; &quot;2021-10-24T02:13:06.610Z&quot; &#039;es&#039;}} =&gt; 2021/10/24</code></pre>
1333
+ </div>
1334
+ </td>
1335
+ </tr>
1336
+ </tbody>
1337
+ </table>
1306
1338
  <!-- end::Views -->
1307
1339
 
1308
1340
  <!-- begin::Model -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-sweet",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Extend Express functionality with Express Sweet and start developing fast, minimal web applications.",
5
5
  "main": "dist/build.common.js",
6
6
  "module": "dist/build.esm.js",
@@ -1,21 +1,14 @@
1
1
  /**
2
- * Stringify an object using JSON.stringify.
2
+ * Use moment to format the date.
3
3
  *
4
4
  * @example
5
- * {{json_stringify value}}
6
- *
7
- * @param {any} value The value to convert to a JSON string.
8
- * @param {number} indent The number of space characters to use as whitespace.
9
- * @return {string} A JSON string representing the given value, or undefined.
10
- */
11
- export declare function json_stringify(value: any, indent?: number | string): string | undefined;
12
- /**
13
- * Parses the given string using JSON.parse.
14
- *
15
- * @example
16
- * {{json_parse value}}
17
- *
18
- * @param {any} value Object to stringify.
19
- * @return {any} JavaScript value or object described by a string.
5
+ * {{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}} => 2021/10/24
6
+ * {{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}} => 2021/10/24
7
+ * {{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}} => 2021/10/24
8
+ *
9
+ * @param {string} format A format string based on moment.
10
+ * @param {string} date Date string to format.
11
+ * @param {string|string[]} locale Language or language-country locale string (or array of strings) available in https://github.com/moment/moment/tree/develop/locale .
12
+ * @returns {string} Returns formatted date.
20
13
  */
21
- export declare function json_parse(value: any): any;
14
+ export declare function format_date(format: string, date: string, locale: string | string[]): string;
@@ -2,4 +2,5 @@ import * as html from './html';
2
2
  import * as object from './object';
3
3
  import * as string from './string';
4
4
  import * as comparison from './comparison';
5
- export { html, object, string, comparison };
5
+ import * as date from './date';
6
+ export { html, object, string, comparison, date };
@@ -2,5 +2,6 @@ declare const _default: {
2
2
  isAsyncFunction: (value: Function) => boolean;
3
3
  isString: (value: any) => boolean;
4
4
  isObject: (value: any) => boolean;
5
+ isArray: (value: any) => boolean;
5
6
  };
6
7
  export default _default;
@@ -0,0 +1,8 @@
1
+ declare const _default: (value: any) => boolean;
2
+ /**
3
+ * Check if param is an array.
4
+ *
5
+ * @param {any} value
6
+ * @returns {boolean}
7
+ */
8
+ export default _default;
@@ -3,6 +3,6 @@ declare const _default: (value: any) => boolean;
3
3
  * Return true if `val` is a non-empty string.
4
4
  *
5
5
  * @param {any} `val` The value to check
6
- * @return {Boolean}
6
+ * @return {boolean}
7
7
  */
8
8
  export default _default;