|
| 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.<{value:number, text:string, alt:string}></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.<{value:number, text:string, alt:string}></code> |
| 48 | +generate items for fields |
| 49 | + |
| 50 | +**Kind**: global function |
| 51 | +**Returns**: <code>Array.<{value:number, text:string, alt:string}></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