Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
transformChip(chip:any){
// If it is an object, it's already a known chip
if (angular.isObject(chip)) {
return chip;
}
// Otherwise, create a new one
return {name: chip}
}
}
$scope.isJson = function(value) {
// if value is already parsed return true
if (angular.isObject(value) || angular.isArray(value)) {
return true;
}
var err;
try {
JSON.parse(value);
} catch (error) {
err = error;
}
return !err;
};
function isTlpModalOptionValid(options) {
return isUndefined(options.tlpModalOptions) || isObject(options.tlpModalOptions);
}
function isResolveOptionValid(options) {
return isUndefined(options.resolve) || isObject(options.resolve);
}
setControllerServicePropertyDisplayName=(property: any) => {
let setDisplayValue = (property :any) : boolean => {
let cacheEntry:string = controllerServiceDisplayCache[property.value];
if(cacheEntry != null) {
property.displayValue =cacheEntry;
return true;
}
return false;
}
if(angular.isObject(property.propertyDescriptor) && angular.isString(property.propertyDescriptor.identifiesControllerService)) {
if (!setDisplayValue(property)) {
let entry: any = controllerServiceDisplayCachePromiseTracker[property.propertyDescriptor.identifiesControllerService];
if (entry == undefined) {
let promise = this.getAvailableControllerServices(property.propertyDescriptor.identifiesControllerService);
entry = {request: promise, waitingProperties: []};
entry.waitingProperties.push(property);
controllerServiceDisplayCachePromiseTracker[property.propertyDescriptor.identifiesControllerService] = entry;
promise.then((services: any) => {
_.each(services, (service: any) => {
controllerServiceDisplayCache[service.id] = service.name;
});
_.each(entry.waitingProperties, (property: any) => {
setDisplayValue(property);
});
delete controllerServiceDisplayCachePromiseTracker[property.propertyDescriptor.identifiesControllerService];
function showDefinitions(definitions) {
return angular.isObject(definitions);
}
setDomainTypeForField(field: TableColumnDefinition, policy: TableFieldPolicy, domainType: DomainType) {
policy.$currentDomainType = domainType;
policy.domainTypeId = domainType.id;
if (angular.isObject(domainType.field)) {
field.tags = angular.copy(domainType.field.tags);
if (angular.isString(domainType.field.name) && domainType.field.name.length > 0) {
field.name = domainType.field.name;
}
if (angular.isString(domainType.field.derivedDataType) && domainType.field.derivedDataType.length > 0) {
field.derivedDataType = domainType.field.derivedDataType;
field.precisionScale = domainType.field.precisionScale;
field.dataTypeDisplay = this.getDataTypeDisplay(field);
}
}
if (angular.isObject(domainType.fieldPolicy)) {
policy.standardization = angular.copy(domainType.fieldPolicy.standardization);
policy.validation = angular.copy(domainType.fieldPolicy.validation);
}
}
setNodeStyle(node: any, style: any) {
if (style) {
if ((style.shape == 'icon' || !style.shape) && style.icon && style.icon.code) {
node.shape = 'icon';
if (angular.isObject(style.icon)) {
node.icon = style.icon;
}
}
else if (style.shape) {
node.shape = style.shape;
}
if (style.color) {
node.color = style.color;
}
if (style.size) {
node.size = style.size;
}
if (style.font) {
node.font = style.font;
}
function getPropWatchDepth(defaultWatch: string, prop: string | any[]) {
const customWatchDepth = Array.isArray(prop) && angular.isObject(prop[1]) && prop[1].watchDepth;
return customWatchDepth || defaultWatch;
}
build(graph, name = 'root', level = 0, kind) {
if (angular.isArray(graph)) {
return this.buildArray(graph, name, level, kind);
}
else if (angular.isObject(graph)) {
return this.buildObject(graph, name, level, kind);
}
const node = new this.Node(name, level, 'value');
node.value = graph;
node.kind = kind;
return node;
}