pon-shared-pon.universe.frontend.shared.componentlibrary
Version:
shared components for Pon Universe
23 lines (17 loc) • 507 B
JavaScript
import Vue from "vue";
export const splitString = string =>
string.split("$html").length > 1
? string.split("$html").map(value => value.trim())
: "";
export const getTextSnippet = (splitArray, index = 0) => {
if (!splitArray || splitArray.length <= index) {
return "";
}
return splitArray[index];
};
export default Vue.filter("ParseSplitString", (string, index) => {
if (!string) {
return "";
}
return getTextSnippet(splitString(string), index);
});