ignore undefined asset strings

There are specs which do not appropriately provide an asset string and
consequently explode in hard-to-debug ways. Since this function can
already return undefined, providing a default empty string does not
impact the behavior.

There are no specs for this function, sadly.

test plan:
 * Verify Jenkins passes

Change-Id: Ibba39fce03ab8cedd5e275887366db0ec4dfa482
Reviewed-on: https://gerrit.instructure.com/149241
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
Product-Review: Jeremy Neander <jneander@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
This commit is contained in:
Jeremy Neander 2018-05-04 11:54:41 -05:00
parent 96e7f9187e
commit 3f0629e9bd
1 changed files with 1 additions and 1 deletions

View File

@ -17,7 +17,7 @@
import pluralize from 'str/pluralize'
export default function splitAssetString (assetString, toPlural = true) {
export default function splitAssetString (assetString = '', toPlural = true) {
const match = assetString.match(/(.*)_(\d+)$/)
if (match) {
const contextType = toPlural ? pluralize(match[1]) : match[1]