[CI Skip] 0.32.4

This commit is contained in:
Travis CI
2018-10-19 15:38:45 +00:00
parent 1fb1f9d743
commit d7b83e3d91
243 changed files with 17626 additions and 40 deletions
+41
View File
@@ -0,0 +1,41 @@
# Functions
<a id="hexfixlength"></a>
## hexFixLength
▸ **hexFixLength**(value: *`string`*, bitLength?: *`number`*, withPadding?: *`boolean`*): `string`
*Defined in [hex/fixLength.ts:25](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/util/src/hex/fixLength.ts#L25)*
*__name__*: hexFixLength
*__signature__*: hexFixLength (value: string, bitLength: number = -1, withPadding: boolean = false): string
*__summary__*: Shifts a hex string to a specific bitLength
*__description__*: Returns a `0x` prefixed string with the specified number of bits contained in the return value. (If bitLength is -1, length checking is not done). Values with more bits are trimmed to the specified length. Input values with less bits are returned as-is by default. When `withPadding` is set, shorter values are padded with `0`.
*__example__*:
```javascript
import { hexFixLength } from '@polkadot/util';
console.log('fixed', hexFixLength('0x12', 16)); // => 0x12
console.log('fixed', hexFixLength('0x12', 16, true)); // => 0x0012
console.log('fixed', hexFixLength('0x0012', 8)); // => 0x12
```
**Parameters:**
| Param | Type | Default value |
| ------ | ------ | ------ |
| value | `string` | - |
| `Default value` bitLength | `number` | -1 |
| `Default value` withPadding | `boolean` | false |
**Returns:** `string`
___