(options?: { inplace?: boolean })
| 117 | */ |
| 118 | capitalize(options?: { inplace?: boolean }): Series |
| 119 | capitalize(options?: { inplace?: boolean }): Series | void { |
| 120 | const { inplace } = { inplace: false, ...options } |
| 121 | const newArr: Array<string | number> = []; |
| 122 | this.values.map((val) => { |
| 123 | if (utils.isEmpty(val)) { |
| 124 | newArr.push(NaN); |
| 125 | } else { |
| 126 | let firstChar = `${val}`.slice(0, 1); |
| 127 | let leftChar = `${val}`.slice(1); |
| 128 | let newStr = `${firstChar.toUpperCase()}${leftChar.toLowerCase()}`; |
| 129 | newArr.push(newStr); |
| 130 | } |
| 131 | |
| 132 | }); |
| 133 | |
| 134 | if (inplace) { |
| 135 | this.series.$setValues(newArr as ArrayType1D) |
| 136 | this.series.print() |
| 137 | } else { |
| 138 | const sf = this.series.copy() |
| 139 | sf.$setValues(newArr as ArrayType1D) |
| 140 | return sf; |
| 141 | } |
| 142 | |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Returns the character at the specified index (position) |
no test coverage detected