Files
common/docs/util/modules/_hex_addprefix_.md
T
2019-02-19 15:11:49 +00:00

37 lines
740 B
Markdown

# Functions
<a id="hexaddprefix"></a>
## hexAddPrefix
▸ **hexAddPrefix**(value?: *`string` \| `null`*): `string`
*Defined in [hex/addPrefix.ts:21](https://github.com/polkadot-js/common/blob/e19d377/packages/util/src/hex/addPrefix.ts#L21)*
*__name__*: hexAddPrefix
*__summary__*: Adds the `0x` prefix to string values.
*__description__*: Returns a `0x` prefixed string from the input value. If the input is already prefixed, it is returned unchanged.
*__example__*:
```javascript
import { hexAddPrefix } from '@polkadot/util';
console.log('With prefix', hexAddPrefix('0a0b12')); // => 0x0a0b12
```
**Parameters:**
| Name | Type |
| ------ | ------ |
| `Optional` value | `string` \| `null` |
**Returns:** `string`
___