Home

function: trimStart


trimStart(string: string, chars: string): string

Removes leading whitespace or specified characters from `string`.

Example(s):

trimStart('  abc  ')
// => 'abc  '

trimStart('-_-abc-_-', '_-')
// => 'abc-_-'

Params:

Name Type Attribute Description
string The string to trim.
chars The characters to trim.

Returns:

string

  {
    "comment": "/**\r\n * Removes leading whitespace or specified characters from `string`.\r\n *\r\n * @since 4.0.0\r\n * @category String\r\n * @param {string} [string=''] The string to trim.\r\n * @param {string} [chars=whitespace] The characters to trim.\r\n * @returns {string} Returns the trimmed string.\r\n * @see trim, trimEnd\r\n * @example\r\n *\r\n * trimStart('  abc  ')\r\n * // => 'abc  '\r\n *\r\n * trimStart('-_-abc-_-', '_-')\r\n * // => 'abc-_-'\r\n */",
    "meta": {
        "range": [
            660,
            987
        ],
        "filename": "trimStart.js",
        "lineno": 24,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100010656",
            "name": "trimStart",
            "type": "FunctionDeclaration",
            "paramnames": [
                "string",
                "chars"
            ]
        },
        "vars": {
            "strSymbols": "trimStart~strSymbols",
            "start": "trimStart~start"
        }
    },
    "description": "Removes leading whitespace or specified characters from `string`.",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "String",
            "value": "String"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "optional": true,
            "defaultvalue": "''",
            "description": "The string to trim.",
            "name": "string"
        },
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "optional": true,
            "defaultvalue": "whitespace",
            "description": "The characters to trim.",
            "name": "chars"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "string"
                ]
            },
            "description": "Returns the trimmed string."
        }
    ],
    "see": [
        "trim, trimEnd"
    ],
    "examples": [
        "trimStart('  abc  ')\r// => 'abc  '\r\rtrimStart('-_-abc-_-', '_-')\r// => 'abc-_-'"
    ],
    "name": "trimStart",
    "longname": "trimStart",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000965",
    "___s": true,
    "filepath": "trimStart.js"
}