mirror of
https://github.com/atom/atom.git
synced 2026-02-18 10:31:54 -05:00
Rename hasSurrogatePairs() to hasSurrogatePair()
This commit is contained in:
@@ -4,7 +4,7 @@ textUtils = require 'text-utils'
|
||||
module.exports =
|
||||
class Token
|
||||
value: null
|
||||
hasSurrogatePairs: false
|
||||
hasSurrogatePair: false
|
||||
scopes: null
|
||||
isAtomic: null
|
||||
isHardTab: null
|
||||
@@ -14,7 +14,7 @@ class Token
|
||||
constructor: ({@value, @scopes, @isAtomic, @bufferDelta, @isHardTab}) ->
|
||||
@screenDelta = @value.length
|
||||
@bufferDelta ?= @screenDelta
|
||||
@hasSurrogatePairs = textUtils.hasSurrogatePairs(@value)
|
||||
@hasSurrogatePair = textUtils.hasSurrogatePair(@value)
|
||||
|
||||
### Public ###
|
||||
|
||||
@@ -30,7 +30,7 @@ class Token
|
||||
[new Token(value: value1, scopes: @scopes), new Token(value: value2, scopes: @scopes)]
|
||||
|
||||
breakOutAtomicTokens: (tabLength, breakOutLeadingWhitespace) ->
|
||||
if @hasSurrogatePairs
|
||||
if @hasSurrogatePair
|
||||
outputTokens = []
|
||||
|
||||
for token in @breakOutSurrogatePairs()
|
||||
|
||||
@@ -27,8 +27,7 @@ isSurrogatePair = (string, index) ->
|
||||
# Returns a {Number}.
|
||||
getCharacterCount = (string) ->
|
||||
count = string.length
|
||||
for index in [0...string.length] when isSurrogatePair(string, index)
|
||||
count--
|
||||
count-- for index in [0...string.length] when isSurrogatePair(string, index)
|
||||
count
|
||||
|
||||
# Does the given string contain at least one surrogate pair?
|
||||
@@ -36,7 +35,7 @@ getCharacterCount = (string) ->
|
||||
# string - The {String} to check for the presence of surrogate pairs.
|
||||
#
|
||||
# Returns a {Boolean}.
|
||||
hasSurrogatePairs = (string) ->
|
||||
hasSurrogatePair = (string) ->
|
||||
string.length isnt getCharacterCount(string)
|
||||
|
||||
module.exports = {getCharacterCount, isSurrogatePair, hasSurrogatePairs}
|
||||
module.exports = {getCharacterCount, isSurrogatePair, hasSurrogatePair}
|
||||
|
||||
Reference in New Issue
Block a user