From d84e4f0a3f0f8781b5eaf8ced83963ceabe01a38 Mon Sep 17 00:00:00 2001 From: Alexander Sokolov Date: Sat, 16 Dec 2017 22:09:06 +0300 Subject: [PATCH] Update convert-string-to-camelcase.md --- snippets/convert-string-to-camelcase.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/convert-string-to-camelcase.md b/snippets/convert-string-to-camelcase.md index ba34a6835..f59d213ae 100644 --- a/snippets/convert-string-to-camelcase.md +++ b/snippets/convert-string-to-camelcase.md @@ -5,8 +5,8 @@ Use `replace()` to remove underscores, hyphens and spaces and convert words to c ```js const toCamelCase = str => str.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2, offset) => p2 ? p2.toUpperCase() : p1.toLowerCase()); -// camelize("some_database_field_name") -> 'someDatabaseFieldName' -// camelize("Some label that needs to be camelized") -> 'someLabelThatNeedsToBeCamelized' -// camelize("some-javascript-property") -> 'someJavascriptProperty' -// camelize("some-mixed_string with spaces_underscores-and-hyphens") -> 'someMixedStringWithSpacesUnderscoresAndHyphens' +// toCamelCase("some_database_field_name") -> 'someDatabaseFieldName' +// toCamelCase("Some label that needs to be camelized") -> 'someLabelThatNeedsToBeCamelized' +// toCamelCase("some-javascript-property") -> 'someJavascriptProperty' +// toCamelCase("some-mixed_string with spaces_underscores-and-hyphens") -> 'someMixedStringWithSpacesUnderscoresAndHyphens' ```