removeWrapIn()
Wrapper.prototype.removeWrapIn()
Wrapper.prototype.removeWrapIn()Returns given text without the opening and closing chars of the Wrapper object.
public removeWrapIn(text: string): string {
return (
(text = this.replaceClosingIn(text, '')),
(text = this.replaceOpeningIn(text, '')),
text
);
}Parameters
text: string
text: stringThe text of a string type to unwrap from the opening and closing chars of the Wrapper object.
Returns
The return value is the text of string type unwrapped from the opening and closing chars of the Wrapper object.
Example usage
// Example usage.
import { Wrapper } from '@angular-package/wrapper';
const longText = new Wrapper('{{', '}}', 'This is a long text');
const text = `Lorem ipsum and more`;
// Returns Lorem ipsum and more.
longText.removeWrapIn(`${longText.opening}${text}${longText.closing}`);
// Returns }}Lorem ipsum and more{{.
longText.removeWrapIn(`${longText.closing}${text}${longText.opening}`);Last updated
Was this helpful?