Skip to content

Commit 66d8b10

Browse files
committed
refactor($interpolate): move standalone functions to the service scope
1 parent afa44f0 commit 66d8b10

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/ng/interpolate.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,25 @@ function $InterpolateProvider() {
8888
return '\\\\\\' + ch;
8989
}
9090

91+
function unescapeText(text) {
92+
return text.replace(escapedStartRegexp, startSymbol).
93+
replace(escapedEndRegexp, endSymbol);
94+
}
95+
96+
function stringify(value) {
97+
if (value == null) { // null || undefined
98+
return '';
99+
}
100+
switch (typeof value) {
101+
case 'string':
102+
case 'number':
103+
case 'boolean':
104+
return value;
105+
default:
106+
return toJson(value);
107+
}
108+
}
109+
91110
/**
92111
* @ngdoc service
93112
* @name $interpolate
@@ -243,20 +262,6 @@ function $InterpolateProvider() {
243262
$sce.valueOf(value);
244263
};
245264

246-
var stringify = function(value) {
247-
if (value == null) { // null || undefined
248-
return '';
249-
}
250-
switch (typeof value) {
251-
case 'string':
252-
case 'number':
253-
case 'boolean':
254-
return value;
255-
default:
256-
return toJson(value);
257-
}
258-
};
259-
260265
return extend(function interpolationFn(context) {
261266
var i = 0;
262267
var ii = expressions.length;
@@ -291,11 +296,6 @@ function $InterpolateProvider() {
291296
});
292297
}
293298

294-
function unescapeText(text) {
295-
return text.replace(escapedStartRegexp, startSymbol).
296-
replace(escapedEndRegexp, endSymbol);
297-
}
298-
299299
function parseStringifyInterceptor(value) {
300300
try {
301301
return stringify(getValue(value));

0 commit comments

Comments
 (0)