diff --git a/js/components/ascribe_buttons/acl_information.js b/js/components/ascribe_buttons/acl_information.js index 87395546..43ad5a2b 100644 --- a/js/components/ascribe_buttons/acl_information.js +++ b/js/components/ascribe_buttons/acl_information.js @@ -4,7 +4,7 @@ import React from 'react'; import classnames from 'classnames'; import { AclInformationText } from '../../constants/acl_information_text'; -import { replaceSubstringAtIndex, sanitize, intersectLists } from '../../utils/general'; +import { intersectLists, sanitize } from '../../utils/general'; import { getLangText } from '../../utils/lang'; @@ -45,7 +45,7 @@ let AclInformation = React.createClass({ return (
- {replaceSubstringAtIndex(info.slice(2), 's ', ' ')} + {info.slice(2).replace('s', '')} {' ' + example} diff --git a/js/components/ascribe_detail/history_iterator.js b/js/components/ascribe_detail/history_iterator.js index 62ac9db4..6cc9552e 100644 --- a/js/components/ascribe_detail/history_iterator.js +++ b/js/components/ascribe_detail/history_iterator.js @@ -5,8 +5,6 @@ import React from 'react'; import Form from '../ascribe_forms/form'; import Property from '../ascribe_forms/property'; -import { replaceSubstringAtIndex } from '../../utils/general'; - let HistoryIterator = React.createClass({ propTypes: { @@ -18,7 +16,7 @@ let HistoryIterator = React.createClass({ // We want to get the capturing group without the quotes, // which is why we access the match list at index 1 and not 0 const contractName = historicalEvent[1].match(/\"(.*)\"/)[1]; - const historicalEventDescription = replaceSubstringAtIndex(historicalEvent[1], `"${contractName}"`, ''); + const historicalEventDescription = historicalEvent[1].replace(`"${contractName}"`, ''); return ( {historicalEventDescription} diff --git a/js/utils/general.js b/js/utils/general.js index 7b2a1bd4..42ea3bba 100644 --- a/js/utils/general.js +++ b/js/utils/general.js @@ -27,16 +27,6 @@ export function escapeHTML(s) { return document.createElement('div').appendChild(document.createTextNode(s)).parentNode.innerHTML; } -/** - * @param index, int, the starting index of the substring to be replaced - * @param character, substring to be replaced - * @returns {string} - */ -export function replaceSubstringAtIndex(baseString, substrToReplace, stringToBePut) { - let index = baseString.indexOf(substrToReplace); - return baseString.substr(0, index) + stringToBePut + baseString.substr(index + substrToReplace.length); -} - /** * Extracts the user's subdomain from the browser's window. * If no subdomain is found (for example on a naked domain), the default "www" is just assumed.