Skip to content

Commit

Permalink
Move String mutations to helpers folder
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlytyler committed Nov 7, 2015
1 parent 4678253 commit 7f5a051
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 130 deletions.
72 changes: 72 additions & 0 deletions dist/helpers/String.js
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'];
62 changes: 2 additions & 60 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ var _path2 = _interopRequireDefault(_path);

var _lodash = require('lodash');

var _changeCase = require('change-case');
var _helpersString = require('./helpers/String');

var _inflection = require('inflection');

var _inflection2 = _interopRequireDefault(_inflection);
var _helpersString2 = _interopRequireDefault(_helpersString);

var _readConfig = require('./read-config');

Expand All @@ -37,62 +35,6 @@ var _generate = require('./generate');

var _generate2 = _interopRequireDefault(_generate);

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);
};

_commander2['default'].version('0.1.0').usage('<keywords> [options]').option('-p, --pod [pods flag]', 'Generates using the defined pods based file structure').option('--pods [pods flag alias]', 'Generates using the defined pods based file structure').on('--help', function () {
return _help2['default'].print();
}).parse(process.argv);
Expand Down
72 changes: 72 additions & 0 deletions src/helpers/String.js
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;
71 changes: 1 addition & 70 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,14 @@
import program from 'commander';
import path from 'path';
import { drop } from 'lodash';
import {
upperCase,
lowerCase,
sentenceCase,
titleCase,
camelCase,
pascalCase,
snakeCase,
paramCase,
dotCase,
pathCase,
constantCase

} from 'change-case';
import inflection from 'inflection';
import String from './helpers/String';

import readConfig from './read-config';
import globalConfigDefaults from './global-config-defaults';
import help from './help';
import generate from './generate';

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);
};

program
.version('0.1.0')
.usage('<keywords> [options]')
Expand Down

0 comments on commit 7f5a051

Please sign in to comment.