|
|
@ -1,15 +1,16 @@
|
|
|
|
module Docs
|
|
|
|
module Docs
|
|
|
|
class Javascript
|
|
|
|
class Javascript
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
TYPES = %w(Array ArrayBuffer Boolean DataView Date Function Intl JSON Map
|
|
|
|
TYPES = %w(Array ArrayBuffer Atomics Boolean DataView Date Function
|
|
|
|
Math Number Object Promise RegExp Set SIMD String Symbol TypedArray
|
|
|
|
Generator Intl JSON Map Math Number Object Promise Reflect RegExp
|
|
|
|
WeakMap WeakSet)
|
|
|
|
Set SharedArrayBuffer SIMD String Symbol TypedArray WeakMap WeakSet)
|
|
|
|
INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat)
|
|
|
|
INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat)
|
|
|
|
|
|
|
|
|
|
|
|
def get_name
|
|
|
|
def get_name
|
|
|
|
if slug.start_with? 'Global_Objects/'
|
|
|
|
if slug.start_with? 'Global_Objects/'
|
|
|
|
name, method, *rest = *slug.sub('Global_Objects/', '').split('/')
|
|
|
|
name, method, *rest = *slug.sub('Global_Objects/', '').split('/')
|
|
|
|
name.prepend 'Intl.' if INTL_OBJECTS.include?(name)
|
|
|
|
name.prepend 'Intl.' if INTL_OBJECTS.include?(name)
|
|
|
|
|
|
|
|
name.prepend 'SIMD.' if html.include?("SIMD.#{name}")
|
|
|
|
|
|
|
|
|
|
|
|
if method
|
|
|
|
if method
|
|
|
|
unless method == method.upcase || method == 'NaN'
|
|
|
|
unless method == method.upcase || method == 'NaN'
|
|
|
@ -18,6 +19,15 @@ module Docs
|
|
|
|
name << ".#{([method] + rest).join('.')}"
|
|
|
|
name << ".#{([method] + rest).join('.')}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if name.exclude?('.prototype')
|
|
|
|
|
|
|
|
path = name.split('.')
|
|
|
|
|
|
|
|
if ((node = at_css('.syntaxbox') || at_css('code')) && node.content =~ /(?:\s|\A)[a-z\_][a-zA-Z\_]+\.#{path.last}/) ||
|
|
|
|
|
|
|
|
((node = at_css('.standard-table')) && node.content =~ /\.prototype[\[\.]#{path.last}/)
|
|
|
|
|
|
|
|
path[-2] = path[-2][0].downcase + path[-2][1..-1]
|
|
|
|
|
|
|
|
name = path.join('.')
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
name
|
|
|
|
name
|
|
|
|
else
|
|
|
|
else
|
|
|
|
name = super
|
|
|
|
name = super
|
|
|
@ -45,6 +55,8 @@ module Docs
|
|
|
|
'Errors'
|
|
|
|
'Errors'
|
|
|
|
elsif INTL_OBJECTS.include?(object)
|
|
|
|
elsif INTL_OBJECTS.include?(object)
|
|
|
|
'Intl'
|
|
|
|
'Intl'
|
|
|
|
|
|
|
|
elsif name.start_with?('SIMD')
|
|
|
|
|
|
|
|
'SIMD'
|
|
|
|
elsif method || TYPES.include?(object)
|
|
|
|
elsif method || TYPES.include?(object)
|
|
|
|
object
|
|
|
|
object
|
|
|
|
else
|
|
|
|
else
|
|
|
|