Skip to content

Commit df5d160

Browse files
committed
docs: add util api, add locale api
1 parent d701d2e commit df5d160

File tree

3 files changed

+146
-0
lines changed

3 files changed

+146
-0
lines changed

docs/src/.vuepress/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ module.exports = {
6969
collapsable: false,
7070
children: [
7171
'core',
72+
'util',
73+
'locale'
7274
]
7375
},
7476
{

docs/src/api/locale.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: locale
3+
---
4+
5+
# locale
6+
7+
## Usage
8+
9+
```js
10+
import core from '@vue-js-cron/core'
11+
const { locale } = core
12+
```
13+
14+
## Functions
15+
16+
<dl>
17+
<dt><a href="#getLocale">getLocale(locale)</a> ⇒ <code>object</code></dt>
18+
<dd></dd>
19+
<dt><a href="#defaultItems">defaultItems(locale)</a> ⇒ <code>object</code></dt>
20+
<dd></dd>
21+
</dl>
22+
23+
<a name="getLocale"></a>
24+
25+
## getLocale(locale) ⇒ <code>object</code>
26+
**Kind**: global function
27+
**Returns**: <code>object</code> - object with all strings in the request language
28+
29+
| Param | Type | Default |
30+
| --- | --- | --- |
31+
| locale | <code>string</code> | <code>&quot;en&quot;</code> |
32+
33+
<a name="defaultItems"></a>
34+
35+
## defaultItems(locale) ⇒ <code>object</code>
36+
**Kind**: global function
37+
**Returns**: <code>object</code> - items for minute, hour, day, month and day of week
38+
39+
| Param | Type |
40+
| --- | --- |
41+
| locale | <code>string</code> |
42+

docs/src/api/util.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: util
3+
---
4+
5+
# util
6+
7+
## Usage
8+
9+
```js
10+
import core from '@vue-js-cron/core'
11+
const { util } = core
12+
```
13+
14+
## Functions
15+
16+
<dl>
17+
<dt><a href="#toText">toText(value)</a> ⇒ <code>string</code></dt>
18+
<dd><p>type definition</p>
19+
</dd>
20+
<dt><a href="#genItems">genItems(min, max, genText, genAltText)</a> ⇒ <code>Array.&lt;{value:number, text:string, alt:string}&gt;</code></dt>
21+
<dd><p>generate items for fields</p>
22+
</dd>
23+
<dt><a href="#pad">pad(n, width)</a> ⇒ <code>string</code></dt>
24+
<dd><p>pads numbers</p>
25+
</dd>
26+
<dt><a href="#isObject">isObject(value)</a> ⇒ <code>Boolean</code></dt>
27+
<dd><p>determines whether the passed value is an object</p>
28+
</dd>
29+
<dt><a href="#deepMerge">deepMerge(target, ...sources)</a> ⇒ <code>object</code></dt>
30+
<dd><p>copies (deep copy) all properties from each source to target</p>
31+
</dd>
32+
</dl>
33+
34+
<a name="toText"></a>
35+
36+
## toText(value) ⇒ <code>string</code>
37+
type definition
38+
39+
**Kind**: global function
40+
41+
| Param | Type |
42+
| --- | --- |
43+
| value | <code>number</code> |
44+
45+
<a name="genItems"></a>
46+
47+
## genItems(min, max, genText, genAltText) ⇒ <code>Array.&lt;{value:number, text:string, alt:string}&gt;</code>
48+
generate items for fields
49+
50+
**Kind**: global function
51+
**Returns**: <code>Array.&lt;{value:number, text:string, alt:string}&gt;</code> - array of items
52+
53+
| Param | Type | Description |
54+
| --- | --- | --- |
55+
| min | <code>number</code> | first value |
56+
| max | <code>number</code> | last value |
57+
| genText | [<code>toText</code>](#toText) | returns a string representation of value |
58+
| genAltText | [<code>toText</code>](#toText) | returns an alternative string representation of value |
59+
60+
<a name="pad"></a>
61+
62+
## pad(n, width) ⇒ <code>string</code>
63+
pads numbers
64+
65+
**Kind**: global function
66+
**Returns**: <code>string</code> - the padded number
67+
68+
| Param | Type | Description |
69+
| --- | --- | --- |
70+
| n | <code>number</code> | number to pad |
71+
| width | <code>number</code> | |
72+
73+
**Example**
74+
```js
75+
//returns "001"
76+
util.pad(1,3)
77+
```
78+
<a name="isObject"></a>
79+
80+
## isObject(value) ⇒ <code>Boolean</code>
81+
determines whether the passed value is an object
82+
83+
**Kind**: global function
84+
**Returns**: <code>Boolean</code> - true if value is an object, otherwise false
85+
86+
| Param | Type |
87+
| --- | --- |
88+
| value | <code>any</code> |
89+
90+
<a name="deepMerge"></a>
91+
92+
## deepMerge(target, ...sources) ⇒ <code>object</code>
93+
copies (deep copy) all properties from each source to target
94+
95+
**Kind**: global function
96+
**Returns**: <code>object</code> - target
97+
98+
| Param | Type |
99+
| --- | --- |
100+
| target | <code>object</code> |
101+
| ...sources | <code>object</code> |
102+

0 commit comments

Comments
 (0)