Return the first 'n' chars of string.
Install
Install all functions of strman
yarn add strmanor just the first function
yarn add strman.firstUsage
import { first } from 'strman'
// OR
import first from 'strman.first'Parameters:
| Name | Type | Description |
|---|---|---|
value |
String | The String! |
n |
String | Number of chars to return. |
Returns:
Return n firsts chars.
- Type
- String
Example
first('strman', 3)
// => 'str'