UNPKG

md-curcuma

Version:

A Typescript library for transporting and converting markdown and other data.

25 lines (24 loc) 791 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TrimString_Mapping = void 0; class TrimString_Mapping { constructor(properties) { this.properties = properties; } perform(mapping_properties) { let str = mapping_properties.source_value; if (str != null && str != undefined) { let ch = this.properties.char; var start = 0, end = str.length; while (start < end && str[start] === ch) ++start; while (end > start && str[end - 1] === ch) --end; return start > 0 || end < str.length ? str.substring(start, end) : str; } else { return str; } } } exports.TrimString_Mapping = TrimString_Mapping;