Skip to content

Commit f06a591

Browse files
committed
Cont remove legacy string calls
1 parent dc4f28f commit f06a591

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

src/animations/animate-js.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function AnimateJsProvider($animateProvider) {
6161
beforeFn = "leave";
6262
afterFn = "afterLeave"; // TODO(matsko): get rid of this
6363
} else {
64-
beforeFn = `before${event.charAt(0).toUpperCase()}${event.substr(1)}`;
64+
beforeFn = `before${event.charAt(0).toUpperCase()}${event.substring(1)}`;
6565
afterFn = event;
6666
}
6767

src/animations/animate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export function AnimateProvider($provide) {
118118
}
119119

120120
const key = `${name}-animation`;
121-
provider.$$registeredAnimations[name.substr(1)] = key;
121+
provider.$$registeredAnimations[name.substring(1)] = key;
122122
$provide.factory(key, factory);
123123
};
124124

src/core/cookie-reader.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("$$cookieReader", () => {
1313
for (let i = 0; i < cookies.length; i++) {
1414
const cookie = cookies[i];
1515
const eqPos = cookie.indexOf("=");
16-
const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
16+
const name = eqPos > -1 ? cookie.substring(0, eqPos) : cookie;
1717
const parts = path.split("/");
1818
while (parts.length) {
1919
document.cookie = `${name}=;path=${parts.join("/") || "/"};expires=Thu, 01 Jan 1970 00:00:00 GMT`;

src/core/location/location.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ export class LocationHtml5Url extends Location {
389389
}
390390

391391
$$normalizeUrl(url) {
392-
return this.appBaseNoFile + url.substr(1); // first char is always '/'
392+
return this.appBaseNoFile + url.substring(1); // first char is always '/'
393393
}
394394

395395
/**
@@ -926,17 +926,17 @@ function startsWith(str, search) {
926926
*/
927927
export function stripBaseUrl(base, url) {
928928
if (startsWith(url, base)) {
929-
return url.substr(base.length);
929+
return url.substring(base.length);
930930
}
931931
}
932932

933933
export function stripHash(url) {
934934
const index = url.indexOf("#");
935-
return index === -1 ? url : url.substr(0, index);
935+
return index === -1 ? url : url.substring(0, index);
936936
}
937937

938938
export function stripFile(url) {
939-
return url.substr(0, stripHash(url).lastIndexOf("/") + 1);
939+
return url.substring(0, stripHash(url).lastIndexOf("/") + 1);
940940
}
941941

942942
/* return the server only (scheme://host:port) */

src/core/parse/parse.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ describe("parser", () => {
688688
scope.zero = 0;
689689
scope.bool = false;
690690

691-
expect(scope.$eval("empty.substr(0)")).toBe("");
691+
expect(scope.$eval("empty.substring(0)")).toBe("");
692692
expect(scope.$eval("zero.toString()")).toBe("0");
693693
expect(scope.$eval("bool.toString()")).toBe("false");
694694
});

src/directive/model/model.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ describe("ngModel", () => {
12651265

12661266
it("should always use the most recent $viewValue for validation", () => {
12671267
ctrl.$parsers.push((value) => {
1268-
if (value && value.substr(-1) === "b") {
1268+
if (value && value.slice(-1) === "b") {
12691269
value = "a";
12701270
ctrl.$setViewValue(value);
12711271
ctrl.$render();
@@ -1288,14 +1288,14 @@ describe("ngModel", () => {
12881288

12891289
it("should validate even if the modelValue did not change", () => {
12901290
ctrl.$parsers.push((value) => {
1291-
if (value && value.substr(-1) === "b") {
1291+
if (value && value.slice(-1) === "b") {
12921292
value = "a";
12931293
}
12941294

12951295
return value;
12961296
});
12971297

1298-
ctrl.$validators.mock = function (modelValue) {
1298+
ctrl.$validators.mock = function () {
12991299
return true;
13001300
};
13011301

src/router/params/param-type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class ParamType {
5151
}
5252
$subPattern() {
5353
const sub = this.pattern.toString();
54-
return sub.substr(1, sub.length - 2);
54+
return sub.substring(1, sub.length - 2);
5555
}
5656
toString() {
5757
return `{ParamType:${this.name}}`;

src/router/state/views.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class Ng1ViewConfig {
177177
ngViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar"
178178
}
179179
if (ngViewName.charAt(0) === "!") {
180-
ngViewName = ngViewName.substr(1);
180+
ngViewName = ngViewName.substring(1);
181181
ngViewContextAnchor = ""; // target absolutely from root
182182
}
183183
// handle parent relative targeting "^.^.^"

src/shared/strings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { pattern, val } from "./hof";
2020
*/
2121
export function maxLength(max, str) {
2222
if (str.length <= max) return str;
23-
return str.substr(0, max - 3) + "...";
23+
return str.substring(0, max - 3) + "...";
2424
}
2525
/**
2626
* Returns a string, with spaces added to the end, up to a desired str length
@@ -46,7 +46,7 @@ export function functionToString(fn) {
4646
const toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;
4747
const fnName = fn["name"] || "";
4848
if (fnName && toStr.match(/function \(/)) {
49-
return "function " + fnName + toStr.substr(9);
49+
return "function " + fnName + toStr.substring(9);
5050
}
5151
return toStr;
5252
}
@@ -97,7 +97,7 @@ export const beforeAfterSubstr = (char) => (str) => {
9797
if (!str) return ["", ""];
9898
const idx = str.indexOf(char);
9999
if (idx === -1) return [str, ""];
100-
return [str.substr(0, idx), str.substr(idx + 1)];
100+
return [str.substring(0, idx), str.substring(idx + 1)];
101101
};
102102
export const hostRegex = new RegExp("^(?:[a-z]+:)?//[^/]+/");
103103
export const stripLastPathElement = (str) => str.replace(/\/[^/]*$/, "");

0 commit comments

Comments
 (0)