MCPcopy Index your code
hub / github.com/nodejs/node / transitionFromUpperToLower

Function transitionFromUpperToLower

test/fixtures/snapshot/typescript.js:142799–142819  ·  view source on GitHub ↗
(identifier, index, wordStart)

Source from the content-addressed store, hash-verified

142797 return every(identifier, function (ch) { return charIsPunctuation(ch) && ch !== 95 /* CharacterCodes._ */; }, start, end);
142798 }
142799 function transitionFromUpperToLower(identifier, index, wordStart) {
142800 // Cases this supports:
142801 // 1) IDisposable -> I, Disposable
142802 // 2) UIElement -> UI, Element
142803 // 3) HTMLDocument -> HTML, Document
142804 //
142805 // etc.
142806 // We have a transition from an upper to a lower letter here. But we only
142807 // want to break if all the letters that preceded are uppercase. i.e. if we
142808 // have "Foo" we don't want to break that into "F, oo". But if we have
142809 // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI,
142810 // Foo". i.e. the last uppercase letter belongs to the lowercase letters
142811 // that follows. Note: this will make the following not split properly:
142812 // "HELLOthere". However, these sorts of names do not show up in .Net
142813 // programs.
142814 return index !== wordStart
142815 && index + 1 < identifier.length
142816 && isUpperCaseLetter(identifier.charCodeAt(index))
142817 && isLowerCaseLetter(identifier.charCodeAt(index + 1))
142818 && every(identifier, isUpperCaseLetter, wordStart, index);
142819 }
142820 function transitionFromLowerToUpper(identifier, word, index) {
142821 var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1));
142822 var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index));

Callers 1

breakIntoSpansFunction · 0.85

Calls 3

isUpperCaseLetterFunction · 0.85
isLowerCaseLetterFunction · 0.85
everyFunction · 0.70

Tested by

no test coverage detected