| @@ -1,15 +1,16 @@ |
| 1 | 1 | module Docs |
| 2 | 2 | class Javascript |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | | − TYPES = %w(Array ArrayBuffer Boolean DataView Date Function Intl JSON Map |
| 5 | | − Math Number Object Promise RegExp Set SIMD String Symbol TypedArray |
| 6 | | − WeakMap WeakSet) |
| 4 | + TYPES = %w(Array ArrayBuffer Atomics Boolean DataView Date Function |
| 5 | + Generator Intl JSON Map Math Number Object Promise Reflect RegExp |
| 6 | + Set SharedArrayBuffer SIMD String Symbol TypedArray WeakMap WeakSet) |
| 7 | 7 | INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat) |
| 8 | 8 | |
| 9 | 9 | def get_name |
| 10 | 10 | if slug.start_with? 'Global_Objects/' |
| 11 | 11 | name, method, *rest = *slug.sub('Global_Objects/', '').split('/') |
| 12 | 12 | name.prepend 'Intl.' if INTL_OBJECTS.include?(name) |
| 13 | + name.prepend 'SIMD.' if html.include?("SIMD.#{name}") |
| 13 | 14 | |
| 14 | 15 | if method |
| 15 | 16 | unless method == method.upcase || method == 'NaN' |
| @@ -18,6 +19,15 @@ module Docs · 2 unmodified lines |
| 18 | 19 | name << ".#{([method] + rest).join('.')}" |
| 19 | 20 | end |
| 20 | 21 | |
| 22 | + if name.exclude?('.prototype') |
| 23 | + path = name.split('.') |
| 24 | + if ((node = at_css('.syntaxbox') || at_css('code')) && node.content =~ /(?:\s|\A)[a-z\_][a-zA-Z\_]+\.#{path.last}/) || |
| 25 | + ((node = at_css('.standard-table')) && node.content =~ /\.prototype[\[\.]#{path.last}/) |
| 26 | + path[-2] = path[-2][0].downcase + path[-2][1..-1] |
| 27 | + name = path.join('.') |
| 28 | + end |
| 29 | + end |
| 30 | + |
| 21 | 31 | name |
| 22 | 32 | else |
| 23 | 33 | name = super |
| @@ -45,6 +55,8 @@ module Docs · 21 unmodified lines |
| 45 | 55 | 'Errors' |
| 46 | 56 | elsif INTL_OBJECTS.include?(object) |
| 47 | 57 | 'Intl' |
| 58 | + elsif name.start_with?('SIMD') |
| 59 | + 'SIMD' |
| 48 | 60 | elsif method || TYPES.include?(object) |
| 49 | 61 | object |
| 50 | 62 | else |