Skip to content

Commit

Permalink
Deprecate String.singularize and String.pluralize
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Jul 12, 2017
1 parent ab8915a commit 9c12ee0
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions addon/lib/ext/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,35 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
@method pluralize
@for String
*/
String.prototype.pluralize = function() {
return pluralize(this);
};
Object.defineProperty(String.prototype, 'pluralize', {
get() {
Ember.deprecate(`String.prototype.pluralize() is deprecated. Please explicitly: import { pluralize } from 'ember-inflector';`, false, {
id: 'ember-inflector.globals',
until: '3.0.0',
});

return function() {
return pluralize(this);
};
},
});

/**
See {{#crossLink "Ember.String/singularize"}}{{/crossLink}}
@method singularize
@for String
*/
String.prototype.singularize = function() {
return singularize(this);
};
Object.defineProperty(String.prototype, 'singularize', {
get() {
Ember.deprecate(`String.prototype.singularize() is deprecated. Please explicitly: import { singularize } from 'ember-inflector';`, false, {
id: 'ember-inflector.globals',
until: '3.0.0',
});

return function() {
return singularize(this);
};
},
});
}

0 comments on commit 9c12ee0

Please sign in to comment.