Skip to content

Commit

Permalink
Remove Ember.String.fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
locks committed Dec 22, 2017
1 parent 573c843 commit a3a53de
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 62 deletions.
14 changes: 0 additions & 14 deletions packages/ember-runtime/lib/ext/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import { ENV } from 'ember-environment';
import {
fmt,
w,
loc,
camelize,
Expand All @@ -18,19 +17,6 @@ import {
const StringPrototype = String.prototype;

if (ENV.EXTEND_PROTOTYPES.String) {
/**
See [Ember.String.fmt](/api/classes/Ember.String.html#method_fmt).
@method fmt
@for @ember/string
@static
@private
@deprecated
*/
StringPrototype.fmt = function (...args) {
return fmt(this, args);
};

/**
See [Ember.String.w](/api/classes/Ember.String.html#method_w).
Expand Down
14 changes: 2 additions & 12 deletions packages/ember-runtime/lib/system/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const CLASSIFY_CACHE = new Cache(1000, str => {
.replace(STRING_CLASSIFY_REGEXP_2, replace2);
}
return parts.join('/')
.replace(STRING_CLASSIFY_REGEXP_3, (match /*, separator, chr */) => match.toUpperCase());
.replace(STRING_CLASSIFY_REGEXP_3, (match /*, separator, chr */) => match.toUpperCase());
});

const STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g);
Expand Down Expand Up @@ -61,23 +61,14 @@ function _fmt(str, formats) {
}

// first, replace any ORDERED replacements.
let idx = 0; // the current index for non-numerical replacements
let idx = 0; // the current index for non-numerical replacements
return str.replace(/%@([0-9]+)?/g, (s, argIndex) => {
argIndex = (argIndex) ? parseInt(argIndex, 10) - 1 : idx++;
s = cachedFormats[argIndex];
return (s === null) ? '(null)' : (s === undefined) ? '' : inspect(s);
});
}

function fmt(/* str, formats */) {
deprecate(
'Ember.String.fmt is deprecated, use ES6 template strings instead.',
false,
{ id: 'ember-string-utils.fmt', until: '3.0.0', url: 'http://babeljs.io/docs/learn-es2015/#template-strings' }
);
return _fmt(...arguments);
}

function loc(str, formats) {
if (!isArray(formats) || arguments.length > 2) {
formats = Array.prototype.slice.call(arguments, 1);
Expand Down Expand Up @@ -308,7 +299,6 @@ export default {
};

export {
fmt,
loc,
w,
decamelize,
Expand Down
36 changes: 0 additions & 36 deletions packages/ember-runtime/tests/system/string/fmt_string_test.js

This file was deleted.

0 comments on commit a3a53de

Please sign in to comment.