express-sweet 1.0.30 → 1.0.31
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 +37 -15
- package/dist/build.common.js +2 -2
- package/dist/build.esm.js +6 -6
- package/docs/index.html +106 -27
- package/package.json +1 -1
- package/types/handlebars_helpers/comparison.d.ts +8 -8
- package/types/handlebars_helpers/date.d.ts +4 -4
- package/types/handlebars_helpers/html.d.ts +3 -3
- package/types/handlebars_helpers/index.d.ts +2 -1
- package/types/handlebars_helpers/number.d.ts +16 -0
- package/types/handlebars_helpers/object.d.ts +4 -4
- package/types/handlebars_helpers/string.d.ts +7 -7
package/docs/index.html
CHANGED
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
<!--begin::Title-->
|
|
82
82
|
<h1 class="page-heading d-flex text-dark fw-bold fs-3 justify-content-center align-items-baseline my-0">
|
|
83
83
|
<!-- <h1 class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0"> -->
|
|
84
|
-
DevDocs<a href="#changelog" class="badge fw-semibold fs-7 px-2 ms-2 bg-body text-dark text-hover-primary shadow-sm">v1.0.
|
|
84
|
+
DevDocs<a href="#changelog" class="badge fw-semibold fs-7 px-2 ms-2 bg-body text-dark text-hover-primary shadow-sm">v1.0.31</a>
|
|
85
85
|
</h1>
|
|
86
86
|
<!--end::Title-->
|
|
87
87
|
</div>
|
|
@@ -469,6 +469,18 @@
|
|
|
469
469
|
<!--end:Menu link-->
|
|
470
470
|
</div>
|
|
471
471
|
<!--end:Menu item-->
|
|
472
|
+
<!--begin:Menu item-->
|
|
473
|
+
<div class="menu-item">
|
|
474
|
+
<!--begin:Menu link-->
|
|
475
|
+
<a class="menu-link" href="#view-number-helper">
|
|
476
|
+
<span class="menu-bullet">
|
|
477
|
+
<span class="bullet bullet-dot"></span>
|
|
478
|
+
</span>
|
|
479
|
+
<span class="menu-title">Number Helper</span>
|
|
480
|
+
</a>
|
|
481
|
+
<!--end:Menu link-->
|
|
482
|
+
</div>
|
|
483
|
+
<!--end:Menu item-->
|
|
472
484
|
</div>
|
|
473
485
|
<!--end:Menu sub-->
|
|
474
486
|
</div>
|
|
@@ -2402,7 +2414,7 @@ Else
|
|
|
2402
2414
|
{{ifx (eq val 1) 5 6}} => 6
|
|
2403
2415
|
{{ifx (not (eq val 1)) 5 6}} => 6
|
|
2404
2416
|
|
|
2405
|
-
|
|
2417
|
+
{{!-- The third parameter is optional, and by default it will be blank string ('') --}}
|
|
2406
2418
|
{{ifx true 'active'}} => 'active'
|
|
2407
2419
|
{{ifx false 'active'}} => ''</code></pre>
|
|
2408
2420
|
</div>
|
|
@@ -2461,7 +2473,7 @@ let val = ' ';
|
|
|
2461
2473
|
</td>
|
|
2462
2474
|
</tr>
|
|
2463
2475
|
<tr>
|
|
2464
|
-
<td class="w-250px"><code>
|
|
2476
|
+
<td class="w-250px"><code>notEmpty()</code></td>
|
|
2465
2477
|
<td>
|
|
2466
2478
|
Check that it is not empty.<br>
|
|
2467
2479
|
If the value is an array, returns true if there is an element.<br>
|
|
@@ -2488,19 +2500,19 @@ let val = ' ';
|
|
|
2488
2500
|
<div class="highlight-code">
|
|
2489
2501
|
<pre class="language-javascript"><code class="language-javascript">{{!-- If the value is an array. --}}
|
|
2490
2502
|
let val = [5, 6];
|
|
2491
|
-
{{
|
|
2503
|
+
{{notEmpty val}} => true
|
|
2492
2504
|
|
|
2493
|
-
{{#if (
|
|
2505
|
+
{{#if (notEmpty val)}}Hello World{{/if}}
|
|
2494
2506
|
|
|
2495
2507
|
{{!-- If the value is a string. --}}
|
|
2496
2508
|
let val = 'Hello World';
|
|
2497
|
-
{{
|
|
2509
|
+
{{notEmpty val}} => true
|
|
2498
2510
|
|
|
2499
2511
|
let val = '';
|
|
2500
|
-
{{
|
|
2512
|
+
{{notEmpty val}} => false
|
|
2501
2513
|
|
|
2502
2514
|
let val = ' ';
|
|
2503
|
-
{{
|
|
2515
|
+
{{notEmpty val}} => false</code></pre>
|
|
2504
2516
|
</div>
|
|
2505
2517
|
</div>
|
|
2506
2518
|
<!--end::Highlight-->
|
|
@@ -2699,7 +2711,7 @@ let val = '2'
|
|
|
2699
2711
|
{{includes items val false}} => true
|
|
2700
2712
|
|
|
2701
2713
|
{{#if (includes items val)}}
|
|
2702
|
-
|
|
2714
|
+
{{!-- Do something --}}
|
|
2703
2715
|
{{/if}}
|
|
2704
2716
|
|
|
2705
2717
|
{{ifx (includes items val) 'Yes' 'No'}}</code></pre>
|
|
@@ -2738,7 +2750,7 @@ let val = '2'
|
|
|
2738
2750
|
<!--begin::Body-->
|
|
2739
2751
|
<tbody>
|
|
2740
2752
|
<tr>
|
|
2741
|
-
<td class="w-250px"><code>
|
|
2753
|
+
<td class="w-250px"><code>cacheBusting()</code></td>
|
|
2742
2754
|
<td>
|
|
2743
2755
|
Returns the Assets path containing the file update time parameter.
|
|
2744
2756
|
<!--begin::Parameters-->
|
|
@@ -2746,7 +2758,7 @@ let val = '2'
|
|
|
2746
2758
|
<p>Parameters:</p>
|
|
2747
2759
|
<ul>
|
|
2748
2760
|
<li><code>filePath: string</code> Paths of Assets files such as CSS and JS in public directories.</li>
|
|
2749
|
-
<li><code>baseUrl: string</code> Application Origin URL.</li>
|
|
2761
|
+
<li><code>baseUrl: string</code> Application Origin URL. The default is none (<code>undefined</code>).</li>
|
|
2750
2762
|
</ul>
|
|
2751
2763
|
</div>
|
|
2752
2764
|
<!--end::Parameters-->
|
|
@@ -2763,7 +2775,7 @@ let val = '2'
|
|
|
2763
2775
|
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
2764
2776
|
<div class="highlight-code">
|
|
2765
2777
|
<pre class="language-javascript"><code class="language-javascript">{{!-- https://example.com/assets/style.css?1620526340463 --}}
|
|
2766
|
-
{{
|
|
2778
|
+
{{cacheBusting '/assets/style.css' 'https://example.com'}}</code></pre>
|
|
2767
2779
|
</div>
|
|
2768
2780
|
</div>
|
|
2769
2781
|
<!--end::Highlight-->
|
|
@@ -2799,7 +2811,7 @@ let val = '2'
|
|
|
2799
2811
|
<!--begin::Body-->
|
|
2800
2812
|
<tbody>
|
|
2801
2813
|
<tr>
|
|
2802
|
-
<td class="w-250px"><code>
|
|
2814
|
+
<td class="w-250px"><code>jsonStringify()</code></td>
|
|
2803
2815
|
<td>
|
|
2804
2816
|
Stringify an object using JSON.stringify.
|
|
2805
2817
|
<!--begin::Parameters-->
|
|
@@ -2823,7 +2835,7 @@ let val = '2'
|
|
|
2823
2835
|
<div class="highlight">
|
|
2824
2836
|
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
2825
2837
|
<div class="highlight-code">
|
|
2826
|
-
<pre class="language-javascript"><code class="language-javascript">{{
|
|
2838
|
+
<pre class="language-javascript"><code class="language-javascript">{{jsonStringify val}}</code></pre>
|
|
2827
2839
|
</div>
|
|
2828
2840
|
</div>
|
|
2829
2841
|
<!--end::Highlight-->
|
|
@@ -2832,7 +2844,7 @@ let val = '2'
|
|
|
2832
2844
|
</td>
|
|
2833
2845
|
</tr>
|
|
2834
2846
|
<tr>
|
|
2835
|
-
<td class="w-250px"><code>
|
|
2847
|
+
<td class="w-250px"><code>jsonParse()</code></td>
|
|
2836
2848
|
<td>
|
|
2837
2849
|
Parses the given string using JSON.parse.
|
|
2838
2850
|
<!--begin::Parameters-->
|
|
@@ -2855,7 +2867,7 @@ let val = '2'
|
|
|
2855
2867
|
<div class="highlight">
|
|
2856
2868
|
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
2857
2869
|
<div class="highlight-code">
|
|
2858
|
-
<pre class="language-javascript"><code class="language-javascript">{{
|
|
2870
|
+
<pre class="language-javascript"><code class="language-javascript">{{jsonParse val}}</code></pre>
|
|
2859
2871
|
</div>
|
|
2860
2872
|
</div>
|
|
2861
2873
|
<!--end::Highlight-->
|
|
@@ -2948,10 +2960,10 @@ let val = '2'
|
|
|
2948
2960
|
<div class="highlight">
|
|
2949
2961
|
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
2950
2962
|
<div class="highlight-code">
|
|
2951
|
-
<pre class="language-javascript"><code class="language-javascript"
|
|
2963
|
+
<pre class="language-javascript"><code class="language-javascript">{{!-- Basic usage. --}}
|
|
2952
2964
|
{{split "a,b,c" ","}} => ['a', 'b', 'c']
|
|
2953
2965
|
|
|
2954
|
-
|
|
2966
|
+
{{!-- Use with EACH. --}}
|
|
2955
2967
|
{{#each (split list ',')}}
|
|
2956
2968
|
{{this}}<br>
|
|
2957
2969
|
{{/each}}
|
|
@@ -2966,7 +2978,7 @@ let val = '2'
|
|
|
2966
2978
|
</td>
|
|
2967
2979
|
</tr>
|
|
2968
2980
|
<tr>
|
|
2969
|
-
<td class="w-250px"><code>
|
|
2981
|
+
<td class="w-250px"><code>formatBytes()</code></td>
|
|
2970
2982
|
<td>
|
|
2971
2983
|
Convert bytes to just the right units(KB, MB, GB, TB, PB, EB, ZB, YB).
|
|
2972
2984
|
<!--begin::Parameters-->
|
|
@@ -2990,10 +3002,10 @@ let val = '2'
|
|
|
2990
3002
|
<div class="highlight">
|
|
2991
3003
|
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
2992
3004
|
<div class="highlight-code">
|
|
2993
|
-
<pre class="language-javascript"><code class="language-javascript">{{
|
|
2994
|
-
{{
|
|
2995
|
-
{{
|
|
2996
|
-
{{
|
|
3005
|
+
<pre class="language-javascript"><code class="language-javascript">{{formatBytes 1024}} => 1 KB
|
|
3006
|
+
{{formatBytes 1234 2}} => 1.21 KB
|
|
3007
|
+
{{formatBytes 1234 3}} => 1.205 KB
|
|
3008
|
+
{{formatBytes 0}} => 0 Bytes</code></pre>
|
|
2997
3009
|
</div>
|
|
2998
3010
|
</div>
|
|
2999
3011
|
<!--end::Highlight-->
|
|
@@ -3029,7 +3041,7 @@ let val = '2'
|
|
|
3029
3041
|
<!--begin::Body-->
|
|
3030
3042
|
<tbody>
|
|
3031
3043
|
<tr>
|
|
3032
|
-
<td class="w-250px"><code>
|
|
3044
|
+
<td class="w-250px"><code>formatDate()</code></td>
|
|
3033
3045
|
<td>
|
|
3034
3046
|
Use moment to format the date.
|
|
3035
3047
|
<!--begin::Parameters-->
|
|
@@ -3054,9 +3066,76 @@ let val = '2'
|
|
|
3054
3066
|
<div class="highlight">
|
|
3055
3067
|
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
3056
3068
|
<div class="highlight-code">
|
|
3057
|
-
<pre class="language-javascript"><code class="language-javascript">{{
|
|
3058
|
-
{{
|
|
3059
|
-
{{
|
|
3069
|
+
<pre class="language-javascript"><code class="language-javascript">{{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}} => 2021/10/24
|
|
3070
|
+
{{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}} => 2021/10/24
|
|
3071
|
+
{{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}} => 2021/10/24</code></pre>
|
|
3072
|
+
</div>
|
|
3073
|
+
</div>
|
|
3074
|
+
<!--end::Highlight-->
|
|
3075
|
+
</div>
|
|
3076
|
+
<!--end::Code-->
|
|
3077
|
+
</td>
|
|
3078
|
+
</tr>
|
|
3079
|
+
</tbody>
|
|
3080
|
+
<!--end::Body-->
|
|
3081
|
+
</table>
|
|
3082
|
+
<!--end::Table-->
|
|
3083
|
+
</div>
|
|
3084
|
+
<!--end::Table wrapper-->
|
|
3085
|
+
</div>
|
|
3086
|
+
<!--end::Table-->
|
|
3087
|
+
<!--begin::Block-->
|
|
3088
|
+
<h2 id="view-number-helper" class="text-gray-700 py-5 fw-normal">Number Helper</h2>
|
|
3089
|
+
<!--end::Block-->
|
|
3090
|
+
<!--begin::Table-->
|
|
3091
|
+
<div class="py-2">
|
|
3092
|
+
<!--begin::Table wrapper-->
|
|
3093
|
+
<div class="table-responsive border rounded">
|
|
3094
|
+
<!--begin::Table-->
|
|
3095
|
+
<table class="table table-striped mb-0 g-6">
|
|
3096
|
+
<!--begin::Head-->
|
|
3097
|
+
<thead>
|
|
3098
|
+
<tr class="fs-4 fw-bold p-6">
|
|
3099
|
+
<th class="min-w-200px">Function</th>
|
|
3100
|
+
<th>Description</th>
|
|
3101
|
+
</tr>
|
|
3102
|
+
</thead>
|
|
3103
|
+
<!--end::Head-->
|
|
3104
|
+
<!--begin::Body-->
|
|
3105
|
+
<tbody>
|
|
3106
|
+
<tr>
|
|
3107
|
+
<td class="w-250px"><code>number2locale()</code></td>
|
|
3108
|
+
<td>
|
|
3109
|
+
Returns the language-sensitive representation of a number as a string.
|
|
3110
|
+
<!--begin::Parameters-->
|
|
3111
|
+
<div class="py-5">
|
|
3112
|
+
<p>Parameters:</p>
|
|
3113
|
+
<ul>
|
|
3114
|
+
<li><code>val: number|string</code> Target number or numeric string.</li>
|
|
3115
|
+
<li><code>locales: string|undefined</code>
|
|
3116
|
+
A string with a BCP 47 language tag, or an array of such strings.<br>
|
|
3117
|
+
Corresponds to the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales" target="_blank">locales</a> parameter of the Intl.NumberFormat() constructor.<br>
|
|
3118
|
+
In implementations without Intl.NumberFormat support, this parameter is ignored and the host's locale is usually used.
|
|
3119
|
+
</li>
|
|
3120
|
+
</ul>
|
|
3121
|
+
</div>
|
|
3122
|
+
<!--end::Parameters-->
|
|
3123
|
+
<!--begin::Return value-->
|
|
3124
|
+
<div class="py-5">
|
|
3125
|
+
<p>Return value:</p>
|
|
3126
|
+
<code>string</code> A string with a language-sensitive representation of the given number.
|
|
3127
|
+
</div>
|
|
3128
|
+
<!--end::Return value-->
|
|
3129
|
+
<!--begin::Code-->
|
|
3130
|
+
<div class="py-5">
|
|
3131
|
+
<!--begin::Highlight-->
|
|
3132
|
+
<div class="highlight">
|
|
3133
|
+
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
3134
|
+
<div class="highlight-code">
|
|
3135
|
+
<pre class="language-javascript"><code class="language-javascript">{{number2locale 123456.789}} => 123,456.789
|
|
3136
|
+
|
|
3137
|
+
{{!-- German uses comma as decimal separator and period for thousands. --}}
|
|
3138
|
+
{{number2locale 123456.789 'de-DE'}} => 123.456,789</code></pre>
|
|
3060
3139
|
</div>
|
|
3061
3140
|
</div>
|
|
3062
3141
|
<!--end::Highlight-->
|
package/package.json
CHANGED
|
@@ -142,7 +142,7 @@ export declare function not(expression: any): boolean;
|
|
|
142
142
|
* {{ifx (eq value 1) 5 6}} => 6 // return (value === 1) ? 5 : 6
|
|
143
143
|
* {{ifx (not (eq value 1)) 5 6}} => 6 // return (value !== 1) ? 5 : 6
|
|
144
144
|
*
|
|
145
|
-
*
|
|
145
|
+
* {{!-- The third parameter is optional, and by default it will be blank string ('') --}}
|
|
146
146
|
* {{ifx true 'active'}} => 'active'
|
|
147
147
|
* {{ifx false 'active'}} => ''
|
|
148
148
|
*
|
|
@@ -188,26 +188,26 @@ export declare function empty(value: any): boolean;
|
|
|
188
188
|
* @example
|
|
189
189
|
* // If the value is an array.
|
|
190
190
|
* let value = [5, 6];
|
|
191
|
-
* {{
|
|
191
|
+
* {{notEmpty value}} => true
|
|
192
192
|
*
|
|
193
|
-
* {{#if (
|
|
193
|
+
* {{#if (notEmpty value)}}
|
|
194
194
|
* Hello
|
|
195
195
|
* {{/if}}
|
|
196
196
|
*
|
|
197
197
|
* // If the value is a string.
|
|
198
198
|
* let value = 'Hello';
|
|
199
|
-
* {{
|
|
199
|
+
* {{notEmpty value}} => true
|
|
200
200
|
*
|
|
201
201
|
* let value = '';
|
|
202
|
-
* {{
|
|
202
|
+
* {{notEmpty value}} => false
|
|
203
203
|
*
|
|
204
204
|
* let value = ' ';
|
|
205
|
-
* {{
|
|
205
|
+
* {{notEmpty value}} => false
|
|
206
206
|
*
|
|
207
207
|
* @param {any} value Character strings, arrays, objects, etc. to be checked.
|
|
208
208
|
* @returns {boolean} Returns true if the value is not empty, false otherwise.
|
|
209
209
|
*/
|
|
210
|
-
export declare function
|
|
210
|
+
export declare function notEmpty(value: any): boolean;
|
|
211
211
|
/**
|
|
212
212
|
* Determine the length of an array.
|
|
213
213
|
*
|
|
@@ -289,7 +289,7 @@ export declare function coalesce(...params: any[]): any;
|
|
|
289
289
|
* {{includes items value false}} => true
|
|
290
290
|
*
|
|
291
291
|
* {{#if (includes items value)}}
|
|
292
|
-
*
|
|
292
|
+
* {{!-- Do something --}}
|
|
293
293
|
* {{/if}}
|
|
294
294
|
*
|
|
295
295
|
* {{ifx (includes items value) 'Yes' 'No'}}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Use moment to format the date.
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
|
-
* {{
|
|
6
|
-
* {{
|
|
7
|
-
* {{
|
|
5
|
+
* {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}} => 2021/10/24
|
|
6
|
+
* {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}} => 2021/10/24
|
|
7
|
+
* {{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}} => 2021/10/24
|
|
8
8
|
*
|
|
9
9
|
* @param {string} format A format string based on moment.
|
|
10
10
|
* @param {string} date Date string to format.
|
|
11
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
12
|
* @returns {string} Returns formatted date.
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function formatDate(format: string, date: string, locale: string | string[]): string;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Returns the Assets path containing the file update time parameter.
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
|
-
* {{
|
|
5
|
+
* {{cacheBusting '/assets/style.css' '//example.com'}} => example.com/assets/style.css?1620526340463
|
|
6
6
|
*
|
|
7
7
|
* @param {string} filePath Paths of Assets files such as CSS and JS in public directories.
|
|
8
|
-
* @param {string} baseUrl Application Origin URL.
|
|
8
|
+
* @param {string} baseUrl Application Origin URL. The default is none (undefined).
|
|
9
9
|
* @return {string} Returns the Assets file path with the update date and time parameters.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function cacheBusting(filePath: string, baseUrl?: string): string;
|
|
@@ -3,4 +3,5 @@ import * as object from './object';
|
|
|
3
3
|
import * as string from './string';
|
|
4
4
|
import * as comparison from './comparison';
|
|
5
5
|
import * as date from './date';
|
|
6
|
-
|
|
6
|
+
import * as number from './number';
|
|
7
|
+
export { html, object, string, comparison, date, number, };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the language-sensitive representation of a number as a string.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* {{number2locale 123456.789}} => 123,456.789
|
|
6
|
+
*
|
|
7
|
+
* {{!-- German uses comma as decimal separator and period for thousands. --}}
|
|
8
|
+
* {{number2locale 123456.789 'de-DE'}} => 123.456,789
|
|
9
|
+
*
|
|
10
|
+
* @param {number|string} val Target number or numeric string.
|
|
11
|
+
* @param {string|undefined} locales A string with a BCP 47 language tag, or an array of such strings.
|
|
12
|
+
* Corresponds to the <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locales">locales</a> parameter of the Intl.NumberFormat() constructor.
|
|
13
|
+
* In implementations without Intl.NumberFormat support, this parameter is ignored and the host's locale is usually used.
|
|
14
|
+
* @return {string} A string with a language-sensitive representation of the given number.
|
|
15
|
+
*/
|
|
16
|
+
export declare function number2locale(val: number | string, locales?: string): string;
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* Stringify an object using JSON.stringify.
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
|
-
* {{
|
|
5
|
+
* {{jsonStringify value}}
|
|
6
6
|
*
|
|
7
7
|
* @param {any} value The value to convert to a JSON string.
|
|
8
8
|
* @param {number} indent The number of space characters to use as whitespace.
|
|
9
9
|
* @return {string} A JSON string representing the given value, or undefined.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function jsonStringify(value: any, indent?: number | string): string | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* Parses the given string using JSON.parse.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
-
* {{
|
|
16
|
+
* {{jsonParse value}}
|
|
17
17
|
*
|
|
18
18
|
* @param {any} value Object to stringify.
|
|
19
19
|
* @return {any} JavaScript value or object described by a string.
|
|
20
20
|
*/
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function jsonParse(value: any): any;
|
|
@@ -14,10 +14,10 @@ export declare function replace(value: string, find: string, replace: string): s
|
|
|
14
14
|
* Split `string` by the given `character`.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
*
|
|
17
|
+
* {{!-- Basic usage. --}}
|
|
18
18
|
* {{split "a,b,c" ","}} => ['a', 'b', 'c']
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* {{!-- Use with EACH. --}}
|
|
21
21
|
* {{#each (split list ',')}}
|
|
22
22
|
* {{this}}<br>
|
|
23
23
|
* {{/each}}
|
|
@@ -34,13 +34,13 @@ export declare function split(value: string, separator: string): string[];
|
|
|
34
34
|
* Convert bytes to just the right units(KB, MB, GB, TB, PB, EB, ZB, YB).
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
|
-
* {{
|
|
38
|
-
* {{
|
|
39
|
-
* {{
|
|
40
|
-
* {{
|
|
37
|
+
* {{formatBytes 1024}} => 1 KB
|
|
38
|
+
* {{formatBytes 1234 2}} => 1.21 KB
|
|
39
|
+
* {{formatBytes 1234 3}} => 1.205 KB
|
|
40
|
+
* {{formatBytes 0}} => 0 Bytes
|
|
41
41
|
*
|
|
42
42
|
* @param {number} bytes Bytes.
|
|
43
43
|
* @param {number} decimals Number of decimal places to display. Default is 0.
|
|
44
44
|
* @returns {string} Returns a value with units.
|
|
45
45
|
*/
|
|
46
|
-
export declare function
|
|
46
|
+
export declare function formatBytes(bytes: number, decimals?: number): string;
|