V8: Angular Divorce: isString (#7929)
This commit is contained in:
+2
-2
@@ -32,7 +32,7 @@ function fixNumber($parse) {
|
||||
|
||||
//always try to format the model value as an int
|
||||
ctrl.$formatters.push(function (value) {
|
||||
if (angular.isString(value)) {
|
||||
if (Utilities.isString(value)) {
|
||||
return parseFloat(value, 10);
|
||||
}
|
||||
return value;
|
||||
@@ -55,4 +55,4 @@ function fixNumber($parse) {
|
||||
}
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.directives').directive("fixNumber", fixNumber);
|
||||
angular.module('umbraco.directives').directive("fixNumber", fixNumber);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ angular.module("umbraco.directives")
|
||||
}
|
||||
|
||||
var editorConfig = scope.configuration ? scope.configuration : null;
|
||||
if (!editorConfig || angular.isString(editorConfig)) {
|
||||
if (!editorConfig || Utilities.isString(editorConfig)) {
|
||||
editorConfig = tinyMceService.defaultPrevalues();
|
||||
//for the grid by default, we don't want to include the macro toolbar
|
||||
editorConfig.toolbar = _.without(editorConfig, "umbmacro");
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@
|
||||
|
||||
function configureViewModel(isInitLoad) {
|
||||
if (vm.value) {
|
||||
if (angular.isString(vm.value) && vm.value.length > 0) {
|
||||
if (Utilities.isString(vm.value) && vm.value.length > 0) {
|
||||
if (vm.config.storageType === "Json") {
|
||||
//json storage
|
||||
vm.viewModel = JSON.parse(vm.value);
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
|
||||
* @param {any} args either a string representing the 'section' or an object containing: 'section', 'treeAlias', 'customTreeParams', 'cacheKey'
|
||||
*/
|
||||
function load(args) {
|
||||
if (angular.isString(args)) {
|
||||
if (Utilities.isString(args)) {
|
||||
$scope.section = args;
|
||||
}
|
||||
else if (args) {
|
||||
@@ -147,7 +147,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use
|
||||
throw "args.path cannot be null";
|
||||
}
|
||||
|
||||
if (angular.isString(args.path)) {
|
||||
if (Utilities.isString(args.path)) {
|
||||
args.path = args.path.replace('"', '').split(',');
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -72,10 +72,10 @@
|
||||
}
|
||||
|
||||
// Basic options
|
||||
if (angular.isString(opts.theme)) {
|
||||
if (Utilities.isString(opts.theme)) {
|
||||
acee.setTheme('ace/theme/' + opts.theme);
|
||||
}
|
||||
if (angular.isString(opts.mode)) {
|
||||
if (Utilities.isString(opts.mode)) {
|
||||
session.setMode('ace/mode/' + opts.mode);
|
||||
}
|
||||
// Advanced options
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
function umbWordLimitFilter() {
|
||||
return function (collection, property) {
|
||||
|
||||
if (!angular.isString(collection)) {
|
||||
if (!Utilities.isString(collection)) {
|
||||
return collection;
|
||||
}
|
||||
|
||||
@@ -35,4 +35,4 @@
|
||||
|
||||
angular.module('umbraco.filters').filter('umbWordLimit', umbWordLimitFilter);
|
||||
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -613,7 +613,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
if (Utilities.isNumber(v)) {
|
||||
return v > 0;
|
||||
}
|
||||
if (angular.isString(v)) {
|
||||
if (Utilities.isString(v)) {
|
||||
return v === "true";
|
||||
}
|
||||
if (typeof v === "boolean") {
|
||||
|
||||
@@ -351,7 +351,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
if (Utilities.isNumber(v)) {
|
||||
return v > 0;
|
||||
}
|
||||
if (angular.isString(v)) {
|
||||
if (Utilities.isString(v)) {
|
||||
return v === "true";
|
||||
}
|
||||
if (typeof v === "boolean") {
|
||||
|
||||
@@ -56,7 +56,7 @@ function memberResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
if (Utilities.isNumber(v)) {
|
||||
return v > 0;
|
||||
}
|
||||
if (angular.isString(v)) {
|
||||
if (Utilities.isString(v)) {
|
||||
return v === "true";
|
||||
}
|
||||
if (typeof v === "boolean") {
|
||||
|
||||
@@ -27,7 +27,7 @@ function fileManager($rootScope) {
|
||||
setFiles: function (args) {
|
||||
|
||||
//propertyAlias, files
|
||||
if (!angular.isString(args.propertyAlias)) {
|
||||
if (!Utilities.isString(args.propertyAlias)) {
|
||||
throw "args.propertyAlias must be a non empty string";
|
||||
}
|
||||
if (!Utilities.isObject(args.files)) {
|
||||
|
||||
@@ -62,7 +62,7 @@ function macroService() {
|
||||
val = val ? val : "";
|
||||
//need to detect if the val is a string or an object
|
||||
var keyVal;
|
||||
if (angular.isString(val)) {
|
||||
if (Utilities.isString(val)) {
|
||||
keyVal = key + "=\"" + (val ? val : "") + "\" ";
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -45,7 +45,7 @@ function mediaHelper(umbRequestHelper, $log) {
|
||||
|
||||
//this performs a simple check to see if we have a media file as value
|
||||
//it doesnt catch everything, but better then nothing
|
||||
if (angular.isString(item.value) && item.value.indexOf(mediaRoot) === 0) {
|
||||
if (Utilities.isString(item.value) && item.value.indexOf(mediaRoot) === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
* @param {any} requestPath
|
||||
*/
|
||||
function pathToRouteParts(requestPath) {
|
||||
if (!angular.isString(requestPath)) {
|
||||
if (!Utilities.isString(requestPath)) {
|
||||
throw "The value for requestPath is not a string";
|
||||
}
|
||||
var pathAndQuery = requestPath.split("#")[1];
|
||||
@@ -130,11 +130,11 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
*/
|
||||
isRouteChangingNavigation: function (currUrlParams, nextUrlParams) {
|
||||
|
||||
if (angular.isString(currUrlParams)) {
|
||||
if (Utilities.isString(currUrlParams)) {
|
||||
currUrlParams = pathToRouteParts(currUrlParams);
|
||||
}
|
||||
|
||||
if (angular.isString(nextUrlParams)) {
|
||||
if (Utilities.isString(nextUrlParams)) {
|
||||
nextUrlParams = pathToRouteParts(nextUrlParams);
|
||||
}
|
||||
|
||||
@@ -483,14 +483,14 @@ function navigationService($routeParams, $location, $q, $injector, eventsService
|
||||
|
||||
appState.setMenuState("currentNode", node);
|
||||
|
||||
if (action.metaData && action.metaData["actionRoute"] && angular.isString(action.metaData["actionRoute"])) {
|
||||
if (action.metaData && action.metaData["actionRoute"] && Utilities.isString(action.metaData["actionRoute"])) {
|
||||
//first check if the menu item simply navigates to a route
|
||||
var parts = action.metaData["actionRoute"].split("?");
|
||||
$location.path(parts[0]).search(parts.length > 1 ? parts[1] : "");
|
||||
this.hideNavigation();
|
||||
return;
|
||||
}
|
||||
else if (action.metaData && action.metaData["jsAction"] && angular.isString(action.metaData["jsAction"])) {
|
||||
else if (action.metaData && action.metaData["jsAction"] && Utilities.isString(action.metaData["jsAction"])) {
|
||||
|
||||
//we'll try to get the jsAction from the injector
|
||||
var menuAction = action.metaData["jsAction"].split('.');
|
||||
|
||||
@@ -25,7 +25,7 @@ function serverValidationManager($timeout) {
|
||||
}
|
||||
|
||||
function getFieldErrors(self, fieldName) {
|
||||
if (!angular.isString(fieldName)) {
|
||||
if (!Utilities.isString(fieldName)) {
|
||||
throw "fieldName must be a string";
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ function serverValidationManager($timeout) {
|
||||
}
|
||||
|
||||
function getPropertyErrors(self, propertyAlias, culture, fieldName) {
|
||||
if (!angular.isString(propertyAlias)) {
|
||||
if (!Utilities.isString(propertyAlias)) {
|
||||
throw "propertyAlias must be a string";
|
||||
}
|
||||
if (fieldName && !angular.isString(fieldName)) {
|
||||
if (fieldName && !Utilities.isString(fieldName)) {
|
||||
throw "fieldName must be a string";
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
var currGroups = saveModel.userGroups;
|
||||
var formattedGroups = [];
|
||||
for (var i = 0; i < currGroups.length; i++) {
|
||||
if (!angular.isString(currGroups[i])) {
|
||||
if (!Utilities.isString(currGroups[i])) {
|
||||
formattedGroups.push(currGroups[i].alias);
|
||||
}
|
||||
else {
|
||||
@@ -229,7 +229,7 @@
|
||||
var currSections = saveModel.sections;
|
||||
var formattedSections = [];
|
||||
for (var i = 0; i < currSections.length; i++) {
|
||||
if (!angular.isString(currSections[i])) {
|
||||
if (!Utilities.isString(currSections[i])) {
|
||||
formattedSections.push(currSections[i].alias);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -91,7 +91,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
}
|
||||
|
||||
return Umbraco.Sys.ServerVariables["umbracoUrls"][apiName] + actionName +
|
||||
(!queryStrings ? "" : "?" + (angular.isString(queryStrings) ? queryStrings : this.dictionaryToQueryString(queryStrings)));
|
||||
(!queryStrings ? "" : "?" + (Utilities.isString(queryStrings) ? queryStrings : this.dictionaryToQueryString(queryStrings)));
|
||||
|
||||
},
|
||||
|
||||
@@ -129,7 +129,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
|
||||
var err = {
|
||||
//NOTE: the default error message here should never be used based on the above docs!
|
||||
errorMsg: (angular.isString(opts) ? opts : 'An error occurred!'),
|
||||
errorMsg: (Utilities.isString(opts) ? opts : 'An error occurred!'),
|
||||
data: data,
|
||||
status: status
|
||||
};
|
||||
@@ -342,11 +342,11 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe
|
||||
//add the json data
|
||||
if (angular.isArray(data)) {
|
||||
_.each(data, function(item) {
|
||||
formData.append(item.key, !angular.isString(item.value) ? Utilities.toJson(item.value) : item.value);
|
||||
formData.append(item.key, !Utilities.isString(item.value) ? Utilities.toJson(item.value) : item.value);
|
||||
});
|
||||
}
|
||||
else {
|
||||
formData.append(data.key, !angular.isString(data.value) ? Utilities.toJson(data.value) : data.value);
|
||||
formData.append(data.key, !Utilities.isString(data.value) ? Utilities.toJson(data.value) : data.value);
|
||||
}
|
||||
|
||||
//call the callback
|
||||
|
||||
@@ -68,7 +68,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar
|
||||
args.event.stopPropagation();
|
||||
args.event.preventDefault();
|
||||
|
||||
if (n.metaData && n.metaData["jsClickCallback"] && angular.isString(n.metaData["jsClickCallback"]) && n.metaData["jsClickCallback"] !== "") {
|
||||
if (n.metaData && n.metaData["jsClickCallback"] && Utilities.isString(n.metaData["jsClickCallback"]) && n.metaData["jsClickCallback"] !== "") {
|
||||
//this is a legacy tree node!
|
||||
var jsPrefix = "javascript:";
|
||||
var js;
|
||||
|
||||
@@ -739,7 +739,7 @@ angular.module("umbraco")
|
||||
//if nothing is found, set it to 12
|
||||
if (!$scope.model.config.items.columns) {
|
||||
$scope.model.config.items.columns = 12;
|
||||
} else if (angular.isString($scope.model.config.items.columns)) {
|
||||
} else if (Utilities.isString($scope.model.config.items.columns)) {
|
||||
$scope.model.config.items.columns = parseInt($scope.model.config.items.columns);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -95,7 +95,7 @@ angular.module('umbraco')
|
||||
//move previously saved value to the editor
|
||||
if ($scope.model.value) {
|
||||
//backwards compat with the old file upload (incase some-one swaps them..)
|
||||
if (angular.isString($scope.model.value)) {
|
||||
if (Utilities.isString($scope.model.value)) {
|
||||
setModelValueWithSrc($scope.model.value);
|
||||
}
|
||||
else {
|
||||
@@ -232,7 +232,7 @@ angular.module('umbraco')
|
||||
|
||||
//this is a fallback in case the cropper has been asssigned a upload field
|
||||
}
|
||||
else if (angular.isString(property.value)) {
|
||||
else if (Utilities.isString(property.value)) {
|
||||
if (thumbnail) {
|
||||
|
||||
if (mediaHelper.detectIfImageByExtension(property.value)) {
|
||||
|
||||
@@ -709,7 +709,7 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
|
||||
}
|
||||
|
||||
function isDate(val) {
|
||||
if (angular.isString(val)) {
|
||||
if (Utilities.isString(val)) {
|
||||
return val.match(/^(\d{4})\-(\d{2})\-(\d{2})\ (\d{2})\:(\d{2})\:(\d{2})$/);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -12,7 +12,7 @@ angular.module("umbraco")
|
||||
$scope.textAreaHtmlId = $scope.model.alias + "_" + String.CreateGuid();
|
||||
|
||||
var editorConfig = $scope.model.config ? $scope.model.config.editor : null;
|
||||
if (!editorConfig || angular.isString(editorConfig)) {
|
||||
if (!editorConfig || Utilities.isString(editorConfig)) {
|
||||
editorConfig = tinyMceService.defaultPrevalues();
|
||||
}
|
||||
//make sure there's a max image size
|
||||
|
||||
@@ -3,7 +3,7 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.RteController",
|
||||
var cfg = tinyMceService.defaultPrevalues();
|
||||
|
||||
if($scope.model.value){
|
||||
if(angular.isString($scope.model.value)){
|
||||
if(Utilities.isString($scope.model.value)){
|
||||
$scope.model.value = cfg;
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -165,7 +165,7 @@ angular.mock.$Browser.prototype = {
|
||||
if (value == undefined) {
|
||||
delete this.cookieHash[name];
|
||||
} else {
|
||||
if (angular.isString(value) && //strings only
|
||||
if (Utilities.isString(value) && //strings only
|
||||
value.length <= 4096) { //strict cookie storage limits
|
||||
this.cookieHash[name] = value;
|
||||
}
|
||||
@@ -486,7 +486,7 @@ angular.mock.$LogProvider = function () {
|
||||
*/
|
||||
angular.mock.TzDate = function (offset, timestamp) {
|
||||
var self = new Date(0);
|
||||
if (angular.isString(timestamp)) {
|
||||
if (Utilities.isString(timestamp)) {
|
||||
var tsStr = timestamp;
|
||||
|
||||
self.origDate = jsonStringToDate(timestamp);
|
||||
@@ -943,7 +943,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
|
||||
wasExpected = false;
|
||||
|
||||
function prettyPrint(data) {
|
||||
return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp)
|
||||
return (Utilities.isString(data) || angular.isFunction(data) || data instanceof RegExp)
|
||||
? data
|
||||
: angular.toJson(data);
|
||||
}
|
||||
@@ -1385,7 +1385,7 @@ function MockHttpExpectation(method, url, data, headers) {
|
||||
this.matchData = function (d) {
|
||||
if (angular.isUndefined(data)) return true;
|
||||
if (data && angular.isFunction(data.test)) return data.test(d);
|
||||
if (data && !angular.isString(data)) return angular.toJson(data) == d;
|
||||
if (data && !Utilities.isString(data)) return angular.toJson(data) == d;
|
||||
return data == d;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user