Skip to content

Commit

Permalink
Merge pull request #866 from MetadataConsulting/MET-1290-url-metadata…
Browse files Browse the repository at this point in the history
…-tokenized

MET-1290 do not tokenize if the metadata key is url
  • Loading branch information
musketyr authored Oct 25, 2016
2 parents d654bbf + 7a41301 commit b4b51f8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ propertyNamesFromQualifiers = {}
names = {
getNaturalName: (propertyName) ->
return null if not propertyName
return propertyName if propertyName.indexOf('http') == 0
naturalNames[propertyName] = naturalNames[propertyName] ? (word[0].toUpperCase() + word[1..-1].toLowerCase() for word in propertyName.split /(?=[A-Z])(?=[A-Z])|\s+/g).join(' ').replace /([A-Z]) (?=([A-Z] ))/g, '$1'


getPropertyNameFromType: (type) ->
return null if not type
return type if type.indexOf('http') == 0
cached = propertyNamesFromTypes[type]
return cached if cached
simpleName = type
Expand All @@ -21,10 +23,11 @@ names = {

getPropertyNameFromQualifier: (type) ->
return null if not type
return type if type.indexOf('http') == 0
propertyNamesFromQualifiers[type] = propertyNamesFromQualifiers[type] ? if type.indexOf('.') > -1 then type.substring(type.lastIndexOf('.') + 1) else type

capitalize: (words) ->
return words.replace /(?:^|\s)\S/g, (a) -> return a.toUpperCase()
}

angular.module( 'mc.util.names', []).constant 'names', names
angular.module( 'mc.util.names', []).constant 'names', names

0 comments on commit b4b51f8

Please sign in to comment.