@dxtmisha/functional-basic 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/package.json +5 -3
  2. package/src/classes/Api.ts +407 -0
  3. package/src/classes/ApiDefault.ts +83 -0
  4. package/src/classes/ApiHeaders.ts +52 -0
  5. package/src/classes/ApiPreparation.ts +114 -0
  6. package/src/classes/ApiResponse.ts +293 -0
  7. package/src/classes/ApiStatus.ts +173 -0
  8. package/src/classes/BroadcastMessage.ts +73 -0
  9. package/src/classes/Cache.ts +60 -0
  10. package/src/classes/CacheItem.ts +95 -0
  11. package/src/classes/CacheStatic.ts +30 -0
  12. package/src/classes/Cookie.ts +135 -0
  13. package/src/classes/CookieBlock.ts +31 -0
  14. package/src/classes/DataStorage.ts +194 -0
  15. package/src/classes/Datetime.ts +891 -0
  16. package/src/classes/EventItem.ts +373 -0
  17. package/src/classes/Geo.ts +320 -0
  18. package/src/classes/GeoFlag.ts +386 -0
  19. package/src/classes/GeoIntl.ts +839 -0
  20. package/src/classes/GeoPhone.ts +272 -0
  21. package/src/classes/Global.ts +32 -0
  22. package/src/classes/Hash.ts +142 -0
  23. package/src/classes/Icons.ts +165 -0
  24. package/src/classes/Loading.ts +90 -0
  25. package/src/classes/Meta.ts +284 -0
  26. package/src/classes/MetaManager.ts +200 -0
  27. package/src/classes/MetaOg.ts +147 -0
  28. package/src/classes/MetaTwitter.ts +154 -0
  29. package/src/classes/ScrollbarWidth.ts +86 -0
  30. package/src/classes/Translate.ts +293 -0
  31. package/src/classes/__tests__/Api.test.ts +728 -0
  32. package/src/classes/__tests__/ApiDefault.test.ts +222 -0
  33. package/src/classes/__tests__/ApiHeaders.test.ts +447 -0
  34. package/src/classes/__tests__/ApiPreparation.test.ts +257 -0
  35. package/src/classes/__tests__/ApiResponse.test.ts +547 -0
  36. package/src/classes/__tests__/ApiStatus.test.ts +403 -0
  37. package/src/classes/__tests__/Meta.test.ts +629 -0
  38. package/src/classes/__tests__/MetaManager.test.ts +836 -0
  39. package/src/classes/__tests__/MetaOg.test.ts +677 -0
  40. package/src/classes/__tests__/MetaTwitter.test.ts +423 -0
  41. package/src/functions/anyToString.ts +36 -0
  42. package/src/functions/applyTemplate.ts +63 -0
  43. package/src/functions/arrFill.ts +10 -0
  44. package/src/functions/copyObject.ts +10 -0
  45. package/src/functions/createElement.ts +40 -0
  46. package/src/functions/domQuerySelector.ts +15 -0
  47. package/src/functions/domQuerySelectorAll.ts +15 -0
  48. package/src/functions/encodeAttribute.ts +15 -0
  49. package/src/functions/eventStopPropagation.ts +10 -0
  50. package/src/functions/executeFunction.ts +13 -0
  51. package/src/functions/executePromise.ts +19 -0
  52. package/src/functions/forEach.ts +39 -0
  53. package/src/functions/frame.ts +38 -0
  54. package/src/functions/getAttributes.ts +27 -0
  55. package/src/functions/getClipboardData.ts +13 -0
  56. package/src/functions/getColumn.ts +18 -0
  57. package/src/functions/getElement.ts +35 -0
  58. package/src/functions/getElementId.ts +39 -0
  59. package/src/functions/getElementItem.ts +27 -0
  60. package/src/functions/getElementOrWindow.ts +23 -0
  61. package/src/functions/getExp.ts +21 -0
  62. package/src/functions/getItemByPath.ts +24 -0
  63. package/src/functions/getKey.ts +9 -0
  64. package/src/functions/getLengthOfAllArray.ts +13 -0
  65. package/src/functions/getMaxLengthAllArray.ts +13 -0
  66. package/src/functions/getMinLengthAllArray.ts +13 -0
  67. package/src/functions/getMouseClient.ts +17 -0
  68. package/src/functions/getMouseClientX.ts +9 -0
  69. package/src/functions/getMouseClientY.ts +9 -0
  70. package/src/functions/getObjectByKeys.ts +24 -0
  71. package/src/functions/getObjectNoUndefined.ts +23 -0
  72. package/src/functions/getObjectOrNone.ts +11 -0
  73. package/src/functions/getRandomText.ts +29 -0
  74. package/src/functions/getRequestString.ts +21 -0
  75. package/src/functions/getStepPercent.ts +19 -0
  76. package/src/functions/getStepValue.ts +19 -0
  77. package/src/functions/goScroll.ts +40 -0
  78. package/src/functions/inArray.ts +10 -0
  79. package/src/functions/initScrollbarOffset.ts +14 -0
  80. package/src/functions/intersectKey.ts +34 -0
  81. package/src/functions/isArray.ts +9 -0
  82. package/src/functions/isDifferent.ts +27 -0
  83. package/src/functions/isDomRuntime.ts +12 -0
  84. package/src/functions/isFilled.ts +49 -0
  85. package/src/functions/isFloat.ts +16 -0
  86. package/src/functions/isFunction.ts +11 -0
  87. package/src/functions/isInDom.ts +15 -0
  88. package/src/functions/isIntegerBetween.ts +11 -0
  89. package/src/functions/isNull.ts +11 -0
  90. package/src/functions/isNumber.ts +16 -0
  91. package/src/functions/isObject.ts +9 -0
  92. package/src/functions/isObjectNotArray.ts +11 -0
  93. package/src/functions/isSelected.ts +32 -0
  94. package/src/functions/isSelectedByList.ts +19 -0
  95. package/src/functions/isString.ts +9 -0
  96. package/src/functions/isWindow.ts +11 -0
  97. package/src/functions/random.ts +10 -0
  98. package/src/functions/replaceRecursive.ts +60 -0
  99. package/src/functions/replaceTemplate.ts +22 -0
  100. package/src/functions/secondToTime.ts +20 -0
  101. package/src/functions/setElementItem.ts +56 -0
  102. package/src/functions/setValues.ts +59 -0
  103. package/src/functions/splice.ts +59 -0
  104. package/src/functions/strFill.ts +12 -0
  105. package/src/functions/toArray.ts +19 -0
  106. package/src/functions/toCamelCase.ts +16 -0
  107. package/src/functions/toCamelCaseFirst.ts +12 -0
  108. package/src/functions/toDate.ts +44 -0
  109. package/src/functions/toKebabCase.ts +25 -0
  110. package/src/functions/toNumber.ts +35 -0
  111. package/src/functions/toNumberByMax.ts +33 -0
  112. package/src/functions/toPercent.ts +10 -0
  113. package/src/functions/toPercentBy100.ts +12 -0
  114. package/src/functions/transformation.ts +59 -0
  115. package/src/functions/uniqueArray.ts +9 -0
  116. package/src/functions/writeClipboardData.ts +17 -0
  117. package/src/library.ts +116 -0
  118. package/src/types/apiTypes.ts +143 -0
  119. package/src/types/basicTypes.ts +155 -0
  120. package/src/types/geoTypes.ts +109 -0
  121. package/src/types/metaTypes.ts +764 -0
  122. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,284 @@
1
+ import { isDomRuntime } from '../functions/isDomRuntime'
2
+ import { isFilled } from '../functions/isFilled'
3
+ import { toArray } from '../functions/toArray'
4
+
5
+ import { MetaManager } from './MetaManager'
6
+ import { MetaOg } from './MetaOg'
7
+ import { MetaTwitter } from './MetaTwitter'
8
+
9
+ import { MetaRobots, MetaTag } from '../types/metaTypes'
10
+
11
+ /**
12
+ * Unified class for managing all types of meta tags (standard HTML, Open Graph, Twitter Card).
13
+ *
14
+ * Унифицированный класс для управления всеми типами мета-тегов (стандартные HTML, Open Graph, Twitter Card).
15
+ */
16
+ export class Meta extends MetaManager<MetaTag[]> {
17
+ protected suffix?: string
18
+
19
+ protected og: MetaOg
20
+ protected twitter: MetaTwitter
21
+
22
+ /**
23
+ * Creates an instance of Meta with integrated Open Graph and Twitter Card support.
24
+ *
25
+ * Создает экземпляр Meta с интегрированной поддержкой Open Graph и Twitter Card.
26
+ */
27
+ constructor() {
28
+ super(Object.values(MetaTag))
29
+
30
+ this.og = new MetaOg()
31
+ this.twitter = new MetaTwitter()
32
+ }
33
+
34
+ /**
35
+ * Gets the MetaOg instance for advanced Open Graph operations.
36
+ *
37
+ * Получает экземпляр MetaOg для расширенных операций с Open Graph.
38
+ */
39
+ getOg(): MetaOg {
40
+ return this.og
41
+ }
42
+
43
+ /**
44
+ * Gets the MetaTwitter instance for advanced Twitter Card operations.
45
+ *
46
+ * Получает экземпляр MetaTwitter для расширенных операций с Twitter Card.
47
+ */
48
+ getTwitter(): MetaTwitter {
49
+ return this.twitter
50
+ }
51
+
52
+ /**
53
+ * Gets the page title without suffix.
54
+ *
55
+ * Получает заголовок страницы без суффикса.
56
+ */
57
+ getTitle(): string {
58
+ if (!isDomRuntime()) {
59
+ return ''
60
+ }
61
+
62
+ return document.title
63
+ .replace(this.getSuffix(), '')
64
+ .trim()
65
+ }
66
+
67
+ /**
68
+ * Gets the keywords meta tag.
69
+ *
70
+ * Получает мета-тег keywords.
71
+ */
72
+ getKeywords(): string {
73
+ return this.get(MetaTag.keywords)
74
+ }
75
+
76
+ /**
77
+ * Gets the description meta tag.
78
+ *
79
+ * Получает мета-тег description.
80
+ */
81
+ getDescription(): string {
82
+ return this.get(MetaTag.description)
83
+ }
84
+
85
+ /**
86
+ * Gets the Open Graph image URL.
87
+ *
88
+ * Получает URL изображения Open Graph.
89
+ */
90
+ getImage(): string {
91
+ return this.og.getImage()
92
+ }
93
+
94
+ /**
95
+ * Gets the canonical URL.
96
+ *
97
+ * Получает канонический URL.
98
+ */
99
+ getCanonical(): string {
100
+ return this.get(MetaTag.canonical)
101
+ }
102
+
103
+ /**
104
+ * Gets the robots meta tag value.
105
+ *
106
+ * Получает значение мета-тега robots.
107
+ */
108
+ getRobots(): MetaRobots {
109
+ return this.get(MetaTag.robots) as MetaRobots
110
+ }
111
+
112
+ /**
113
+ * Gets the author meta tag.
114
+ *
115
+ * Получает мета-тег author.
116
+ */
117
+ getAuthor(): string {
118
+ return this.get(MetaTag.author)
119
+ }
120
+
121
+ /**
122
+ * Gets the Open Graph site name.
123
+ *
124
+ * Получает название сайта Open Graph.
125
+ */
126
+ getSiteName(): string {
127
+ return this.og.getSiteName()
128
+ }
129
+
130
+ /**
131
+ * Gets the Open Graph locale.
132
+ *
133
+ * Получает локаль Open Graph.
134
+ */
135
+ getLocale(): string {
136
+ return this.og.getLocale()
137
+ }
138
+
139
+ /**
140
+ * Sets the page title (with suffix) and updates Open Graph and Twitter Card titles.
141
+ *
142
+ * Устанавливает заголовок страницы (с суффиксом) и обновляет заголовки Open Graph и Twitter Card.
143
+ * @param title page title / заголовок страницы
144
+ */
145
+ setTitle(title: string): this {
146
+ if (isDomRuntime()) {
147
+ const fullTitle = isFilled(title)
148
+ ? `${title}${this.getSuffix()}`
149
+ : this.suffix
150
+ ? this.suffix
151
+ : ''
152
+
153
+ document.title = fullTitle
154
+ this.og.setTitle(fullTitle)
155
+ this.twitter.setTitle(fullTitle)
156
+ }
157
+
158
+ return this
159
+ }
160
+
161
+ /**
162
+ * Sets the keywords meta tag.
163
+ *
164
+ * Устанавливает мета-тег keywords.
165
+ * @param keywords keywords as string or array / ключевые слова в виде строки или массива
166
+ */
167
+ setKeywords(keywords: string | string[]): this {
168
+ this.set(MetaTag.keywords, toArray(keywords).join(', '))
169
+ return this
170
+ }
171
+
172
+ /**
173
+ * Sets the description meta tag.
174
+ *
175
+ * Устанавливает мета-тег description.
176
+ * @param description page description / описание страницы
177
+ */
178
+ setDescription(description: string): this {
179
+ this.set(MetaTag.description, description)
180
+ return this
181
+ }
182
+
183
+ /**
184
+ * Sets the image for Open Graph and Twitter Card.
185
+ *
186
+ * Устанавливает изображение для Open Graph и Twitter Card.
187
+ * @param image image URL / URL изображения
188
+ */
189
+ setImage(image: string): this {
190
+ this.og.setImage(image)
191
+ this.twitter.setImage(image)
192
+ return this
193
+ }
194
+
195
+ /**
196
+ * Sets the canonical URL and updates Open Graph and Twitter Card URLs.
197
+ *
198
+ * Устанавливает канонический URL и обновляет URL для Open Graph и Twitter Card.
199
+ * @param canonical canonical URL / канонический URL
200
+ */
201
+ setCanonical(canonical: string): this {
202
+ this.set(MetaTag.canonical, canonical)
203
+ this.og.setUrl(canonical)
204
+ this.twitter.setUrl(canonical)
205
+ return this
206
+ }
207
+
208
+ /**
209
+ * Sets the robots meta tag.
210
+ *
211
+ * Устанавливает мета-тег robots.
212
+ * @param robots robots directive / директива robots
213
+ */
214
+ setRobots(robots: MetaRobots): this {
215
+ this.set(MetaTag.robots, robots)
216
+ return this
217
+ }
218
+
219
+ /**
220
+ * Sets the author meta tag.
221
+ *
222
+ * Устанавливает мета-тег author.
223
+ * @param author author name / имя автора
224
+ */
225
+ setAuthor(author: string): this {
226
+ this.set(MetaTag.author, author)
227
+ return this
228
+ }
229
+
230
+ /**
231
+ * Sets the site name for Open Graph and Twitter Card.
232
+ *
233
+ * Устанавливает название сайта для Open Graph и Twitter Card.
234
+ * @param siteName site name / название сайта
235
+ */
236
+ setSiteName(siteName: string): this {
237
+ this.og.setSiteName(siteName)
238
+ this.twitter.setSite(siteName)
239
+ return this
240
+ }
241
+
242
+ /**
243
+ * Sets the locale for Open Graph.
244
+ *
245
+ * Устанавливает локаль для Open Graph.
246
+ * @param locale locale (e.g. 'en_US', 'ru_RU') / локаль (например, 'en_US', 'ru_RU')
247
+ */
248
+ setLocale(locale: string): this {
249
+ this.og.setLocale(locale)
250
+ return this
251
+ }
252
+
253
+ /**
254
+ * Sets the suffix to append to page title.
255
+ *
256
+ * Устанавливает суффикс для добавления к заголовку страницы.
257
+ * @param suffix title suffix (e.g. 'My Site') / суффикс заголовка (например, 'Мой Сайт')
258
+ */
259
+ setSuffix(suffix?: string) {
260
+ this.suffix = suffix
261
+ }
262
+
263
+ /**
264
+ * Generates the complete HTML for all meta-tags including Open Graph and Twitter Card.
265
+ *
266
+ * Генерирует полный HTML для всех мета-тегов, включая Open Graph и Twitter Card.
267
+ */
268
+ html(): string {
269
+ return `${super.html()}${this.og.html()}${this.twitter.html()}`
270
+ }
271
+
272
+ /**
273
+ * Gets the formatted suffix with separator.
274
+ *
275
+ * Получает отформатированный суффикс с разделителем.
276
+ */
277
+ protected getSuffix(): string {
278
+ if (isFilled(this.suffix)) {
279
+ return ` - ${this.suffix}`
280
+ }
281
+
282
+ return ''
283
+ }
284
+ }
@@ -0,0 +1,200 @@
1
+ import { createElement } from '../functions/createElement'
2
+ import { encodeAttribute } from '../functions/encodeAttribute'
3
+ import { forEach } from '../functions/forEach'
4
+ import { isDomRuntime } from '../functions/isDomRuntime'
5
+
6
+ type MetaList<T extends readonly string[]> = {
7
+ [K in T[number]]?: string
8
+ }
9
+
10
+ /**
11
+ * Class for working with meta tags.
12
+ *
13
+ * Класс для управления мета-тегами.
14
+ */
15
+ export class MetaManager<
16
+ T extends readonly string[],
17
+ Key extends keyof MetaList<T> = keyof MetaList<T>
18
+ > {
19
+ protected readonly items: MetaList<T> = {}
20
+
21
+ /**
22
+ * Creates an instance of MetaManager.
23
+ *
24
+ * Создает экземпляр MetaManager.
25
+ * @param listMeta list of meta-tag names to manage / список имен мета-тегов для управления
26
+ * @param isProperty use 'property' attribute instead of 'name' / использовать атрибут 'property' вместо 'name'
27
+ */
28
+ constructor(
29
+ protected readonly listMeta: T,
30
+ protected readonly isProperty: boolean = false
31
+ ) {
32
+ this.update()
33
+ }
34
+
35
+ /**
36
+ * Returns the list of meta tag names.
37
+ *
38
+ * Возвращает список имен мета-тегов.
39
+ */
40
+ getListMeta(): T {
41
+ return this.listMeta
42
+ }
43
+
44
+ /**
45
+ * Get the content of a meta tag by name.
46
+ *
47
+ * Получает содержимое мета-тега по имени.
48
+ * @param name meta tag name / имя мета-тега
49
+ */
50
+ get(name: Key): string {
51
+ return this.items[name] ?? ''
52
+ }
53
+
54
+ /**
55
+ * Returns all meta tags.
56
+ *
57
+ * Возвращает все мета-теги.
58
+ */
59
+ getItems(): MetaList<T> {
60
+ return this.items
61
+ }
62
+
63
+ /**
64
+ * Returns all meta tags as HTML string.
65
+ *
66
+ * Возвращает все мета-теги в виде HTML-строки.
67
+ */
68
+ html(): string {
69
+ const code = forEach(
70
+ this.listMeta as any,
71
+ name => this.toHtmlString(name as any as Key)
72
+ )
73
+
74
+ return code.join('')
75
+ }
76
+
77
+ /**
78
+ * Sets the content of a meta tag.
79
+ *
80
+ * Устанавливает содержимое мета-тега.
81
+ * @param name meta tag name / имя мета-тега
82
+ * @param content meta tag content / содержимое мета-тега
83
+ */
84
+ set(name: Key, content: string): this {
85
+ this
86
+ .setItem(name, content)
87
+ .setMeta(name)
88
+
89
+ return this
90
+ }
91
+
92
+ /**
93
+ * Sets multiple meta tags from an object.
94
+ *
95
+ * Устанавливает несколько мета-тегов из объекта.
96
+ * @param metaList object with meta tag names and content / объект с именами и содержимым мета-тегов
97
+ */
98
+ setByList(metaList: MetaList<T>): this {
99
+ forEach(
100
+ metaList,
101
+ (content, name) =>
102
+ this.set(name as any as Key, String(content))
103
+ )
104
+
105
+ return this
106
+ }
107
+
108
+ /**
109
+ * Returns the attribute name for meta tags.
110
+ *
111
+ * Возвращает имя атрибута для мета-тегов.
112
+ */
113
+ protected getAttributeName(): string {
114
+ return this.isProperty ? 'property' : 'name'
115
+ }
116
+
117
+ /**
118
+ * Finds a meta element in the DOM.
119
+ *
120
+ * Находит мета-элемент в DOM.
121
+ * @param name meta tag name / имя мета-тега
122
+ */
123
+ protected findMetaElement(name: string): HTMLMetaElement | undefined {
124
+ if (!isDomRuntime()) {
125
+ return undefined
126
+ }
127
+
128
+ const selector = `meta[${this.getAttributeName()}="${name}"]`
129
+
130
+ return document.querySelector<HTMLMetaElement>(selector) || undefined
131
+ }
132
+
133
+ /**
134
+ * Sets the content of a meta tag in internal storage.
135
+ *
136
+ * Устанавливает содержимое мета-тега во внутреннем хранилище.
137
+ * @param name meta tag name / имя мета-тега
138
+ * @param content meta tag content / содержимое мета-тега
139
+ */
140
+ protected setItem(name: Key, content: string): this {
141
+ this.items[name] = content
142
+ return this
143
+ }
144
+
145
+ /**
146
+ * Sets or creates a meta tag in the DOM.
147
+ *
148
+ * Устанавливает или создает мета-тег в DOM.
149
+ * @param name meta tag name / имя мета-тега
150
+ */
151
+ protected setMeta(name: Key): this {
152
+ const element = this.findMetaElement(name)
153
+ const content = this.items[name] ?? ''
154
+
155
+ if (element) {
156
+ element.content = content
157
+ } else if (isDomRuntime()) {
158
+ const options: Record<string, string> = { content }
159
+
160
+ if (this.isProperty) {
161
+ options.property = name
162
+ } else {
163
+ options.name = name
164
+ }
165
+
166
+ createElement(document.head, 'meta', options)
167
+ }
168
+
169
+ return this
170
+ }
171
+
172
+ /**
173
+ * Converts meta tag to HTML string.
174
+ *
175
+ * Преобразует мета-тег в HTML-строку.
176
+ * @param name meta tag name / имя мета-тега
177
+ */
178
+ protected toHtmlString(name: Key): string {
179
+ const content = encodeAttribute(this.items[name] ?? '')
180
+
181
+ if (content) {
182
+ return `<meta ${this.getAttributeName()}="${name}" content="${content}">`
183
+ }
184
+
185
+ return ''
186
+ }
187
+
188
+ /**
189
+ * Updates meta tags data from the DOM.
190
+ *
191
+ * Обновляет данные мета-тегов из DOM.
192
+ */
193
+ protected update(): this {
194
+ this.listMeta.forEach((name) => {
195
+ this.items[name as any as Key] = this.findMetaElement(name)?.content ?? ''
196
+ })
197
+
198
+ return this
199
+ }
200
+ }
@@ -0,0 +1,147 @@
1
+ import { MetaManager } from './MetaManager'
2
+
3
+ import { MetaOpenGraphTag, MetaOpenGraphType } from '../types/metaTypes'
4
+
5
+ /**
6
+ * Class for working with Open Graph meta tags.
7
+ *
8
+ * Класс для управления мета-тегами Open Graph.
9
+ */
10
+ export class MetaOg extends MetaManager<MetaOpenGraphTag[]> {
11
+ constructor() {
12
+ super(Object.values(MetaOpenGraphTag), true)
13
+ }
14
+
15
+ /**
16
+ * Gets the Open Graph title.
17
+ *
18
+ * Получает заголовок Open Graph.
19
+ */
20
+ getTitle(): string {
21
+ return this.get(MetaOpenGraphTag.title)
22
+ }
23
+
24
+ /**
25
+ * Gets the Open Graph type.
26
+ *
27
+ * Получает тип Open Graph.
28
+ */
29
+ getType(): MetaOpenGraphType {
30
+ return this.get(MetaOpenGraphTag.type) as MetaOpenGraphType
31
+ }
32
+
33
+ /**
34
+ * Gets the Open Graph URL.
35
+ *
36
+ * Получает URL Open Graph.
37
+ */
38
+ getUrl(): string {
39
+ return this.get(MetaOpenGraphTag.url)
40
+ }
41
+
42
+ /**
43
+ * Gets the Open Graph image URL.
44
+ *
45
+ * Получает URL изображения Open Graph.
46
+ */
47
+ getImage(): string {
48
+ return this.get(MetaOpenGraphTag.image)
49
+ }
50
+
51
+ /**
52
+ * Gets the Open Graph description.
53
+ *
54
+ * Получает описание Open Graph.
55
+ */
56
+ getDescription(): string {
57
+ return this.get(MetaOpenGraphTag.description)
58
+ }
59
+
60
+ /**
61
+ * Gets the Open Graph locale.
62
+ *
63
+ * Получает локаль Open Graph.
64
+ */
65
+ getLocale(): string {
66
+ return this.get(MetaOpenGraphTag.locale)
67
+ }
68
+
69
+ /**
70
+ * Gets the Open Graph site name.
71
+ *
72
+ * Получает название сайта Open Graph.
73
+ */
74
+ getSiteName(): string {
75
+ return this.get(MetaOpenGraphTag.siteName)
76
+ }
77
+
78
+ /**
79
+ * Sets the Open Graph title.
80
+ *
81
+ * Устанавливает заголовок Open Graph.
82
+ * @param title title / заголовок
83
+ */
84
+ setTitle(title: string): this {
85
+ return this.set(MetaOpenGraphTag.title, title)
86
+ }
87
+
88
+ /**
89
+ * Sets the Open Graph type.
90
+ *
91
+ * Устанавливает тип Open Graph.
92
+ * @param type type / тип
93
+ */
94
+ setType(type: MetaOpenGraphType): this {
95
+ return this.set(MetaOpenGraphTag.type, type)
96
+ }
97
+
98
+ /**
99
+ * Sets the Open Graph URL.
100
+ *
101
+ * Устанавливает URL Open Graph.
102
+ * @param url URL / URL
103
+ */
104
+ setUrl(url: string): this {
105
+ return this.set(MetaOpenGraphTag.url, url)
106
+ }
107
+
108
+ /**
109
+ * Sets the Open Graph image URL.
110
+ *
111
+ * Устанавливает URL изображения Open Graph.
112
+ * @param url image URL / URL изображения
113
+ */
114
+ setImage(url: string): this {
115
+ return this.set(MetaOpenGraphTag.image, url)
116
+ }
117
+
118
+ /**
119
+ * Sets the Open Graph description.
120
+ *
121
+ * Устанавливает описание Open Graph.
122
+ * @param description description / описание
123
+ */
124
+ setDescription(description: string): this {
125
+ return this.set(MetaOpenGraphTag.description, description)
126
+ }
127
+
128
+ /**
129
+ * Sets the Open Graph locale.
130
+ *
131
+ * Устанавливает локаль Open Graph.
132
+ * @param locale locale (e.g. 'en_US', 'ru_RU') / локаль (например, 'en_US', 'ru_RU')
133
+ */
134
+ setLocale(locale: string): this {
135
+ return this.set(MetaOpenGraphTag.locale, locale)
136
+ }
137
+
138
+ /**
139
+ * Sets the Open Graph site name.
140
+ *
141
+ * Устанавливает название сайта Open Graph.
142
+ * @param siteName site name / название сайта
143
+ */
144
+ setSiteName(siteName: string) {
145
+ return this.set(MetaOpenGraphTag.siteName, siteName)
146
+ }
147
+ }