forked from slightlytyler/bluprint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move String mutations to helpers folder
- Loading branch information
1 parent
4678253
commit 7f5a051
Showing
4 changed files
with
147 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
var _changeCase = require('change-case'); | ||
|
||
var _inflection = require('inflection'); | ||
|
||
var _inflection2 = _interopRequireDefault(_inflection); | ||
|
||
String.prototype.upperCase = function () { | ||
return (0, _changeCase.upperCase)(this); | ||
}; | ||
|
||
String.prototype.lowerCase = function () { | ||
return (0, _changeCase.lowerCase)(this); | ||
}; | ||
|
||
String.prototype.capitalize = function () { | ||
return this.charAt(0).toUpperCase() + this.slice(1); | ||
}; | ||
|
||
String.prototype.sentenceCase = function () { | ||
return (0, _changeCase.sentenceCase)(this); | ||
}; | ||
|
||
String.prototype.titleCase = function () { | ||
return (0, _changeCase.titleCase)(this); | ||
}; | ||
|
||
String.prototype.camelCase = function () { | ||
return (0, _changeCase.camelCase)(this); | ||
}; | ||
|
||
String.prototype.pascalCase = function () { | ||
return (0, _changeCase.pascalCase)(this); | ||
}; | ||
|
||
String.prototype.snakeCase = function () { | ||
return (0, _changeCase.snakeCase)(this); | ||
}; | ||
|
||
String.prototype.paramCase = function () { | ||
return (0, _changeCase.paramCase)(this); | ||
}; | ||
|
||
String.prototype.dotCase = function () { | ||
return (0, _changeCase.dotCase)(this); | ||
}; | ||
|
||
String.prototype.pathCase = function () { | ||
return (0, _changeCase.pathCase)(this); | ||
}; | ||
|
||
String.prototype.constantCase = function () { | ||
return (0, _changeCase.upperCase)(this); | ||
}; | ||
|
||
String.prototype.plural = function () { | ||
return _inflection2['default'].pluralize(this); | ||
}; | ||
|
||
String.prototype.singular = function () { | ||
return _inflection2['default'].singularize(this); | ||
}; | ||
|
||
exports['default'] = String; | ||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { | ||
upperCase, | ||
lowerCase, | ||
sentenceCase, | ||
titleCase, | ||
camelCase, | ||
pascalCase, | ||
snakeCase, | ||
paramCase, | ||
dotCase, | ||
pathCase, | ||
constantCase | ||
} from 'change-case'; | ||
import inflection from 'inflection'; | ||
|
||
String.prototype.upperCase = function() { | ||
return upperCase(this); | ||
}; | ||
|
||
String.prototype.lowerCase = function() { | ||
return lowerCase(this); | ||
}; | ||
|
||
String.prototype.capitalize = function() { | ||
return this.charAt(0).toUpperCase() + this.slice(1); | ||
}; | ||
|
||
String.prototype.sentenceCase = function() { | ||
return sentenceCase(this); | ||
}; | ||
|
||
String.prototype.titleCase = function() { | ||
return titleCase(this); | ||
}; | ||
|
||
String.prototype.camelCase = function() { | ||
return camelCase(this); | ||
}; | ||
|
||
String.prototype.pascalCase = function() { | ||
return pascalCase(this); | ||
}; | ||
|
||
String.prototype.snakeCase = function() { | ||
return snakeCase(this); | ||
}; | ||
|
||
String.prototype.paramCase = function() { | ||
return paramCase(this); | ||
}; | ||
|
||
String.prototype.dotCase = function() { | ||
return dotCase(this); | ||
}; | ||
|
||
String.prototype.pathCase = function() { | ||
return pathCase(this); | ||
}; | ||
|
||
String.prototype.constantCase = function() { | ||
return upperCase(this); | ||
}; | ||
|
||
String.prototype.plural = function() { | ||
return inflection.pluralize(this); | ||
}; | ||
|
||
String.prototype.singular = function() { | ||
return inflection.singularize(this); | ||
}; | ||
|
||
export default String; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters