(
repObj: Parameters<BaseLibrary['prepareValue']>[0],
options: AttributeLibraryOptions = {},
)
| 169 | |
| 170 | // Prepare the value to store in the mapping |
| 171 | prepareValue( |
| 172 | repObj: Parameters<BaseLibrary['prepareValue']>[0], |
| 173 | options: AttributeLibraryOptions = {}, |
| 174 | ): ReturnType<BaseLibrary['prepareValue']> { |
| 175 | const replacedObject = { ...repObj }; |
| 176 | |
| 177 | if (!this.isValidSelector(replacedObject.value)) { |
| 178 | return null; |
| 179 | } |
| 180 | |
| 181 | const escapeFreeSelector = AttributeLibrary.removePseudoElements(replacedObject.value); |
| 182 | |
| 183 | // checks if this value was already set |
| 184 | const realSelector = escapeFreeSelector.slice(1, escapeFreeSelector.length); |
| 185 | |
| 186 | if (!options.ignoreAttributeSelectors) { |
| 187 | const newName = this.replaceAttributeSelector(escapeFreeSelector); |
| 188 | |
| 189 | if (newName) { |
| 190 | replacedObject.renamedValue = newName; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | if ( |
| 195 | replacedObject.renamedValue !== undefined |
| 196 | && AttributeLibrary.isSelector(replacedObject.renamedValue) |
| 197 | ) { |
| 198 | replacedObject.renamedValue = ( |
| 199 | replacedObject.renamedValue.slice(1, replacedObject.renamedValue.length) |
| 200 | ); |
| 201 | } |
| 202 | |
| 203 | replacedObject.value = realSelector; |
| 204 | |
| 205 | return replacedObject; |
| 206 | } |
| 207 | |
| 208 | // todo jpeer: #104 remove any |
| 209 | postfetchValue(result: string, opts: AttributeLibraryOptions): string | any { |
nothing calls this directly
no test coverage detected