Skip to content

Commit

Permalink
update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksymStoianov committed Aug 15, 2024
1 parent ed79967 commit 2642037
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/bg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# SettingsService

<div id="badges" align="left">
<img src="https://img.shields.io/github/v/release/MaksymStoianov/SettingsService" alt="Release">
<a href="LICENSE.md"><img src="https://img.shields.io/github/license/MaksymStoianov/SettingsService" alt="License"></a>
<a href="https://github.com/google/clasp"><img src="https://img.shields.io/badge/built%20with-clasp-4285f4.svg" alt="clasp"></a>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/de/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# SettingsService

<div id="badges" align="left">
<img src="https://img.shields.io/github/v/release/MaksymStoianov/SettingsService" alt="Release">
<a href="LICENSE.md"><img src="https://img.shields.io/github/license/MaksymStoianov/SettingsService" alt="License"></a>
<a href="https://github.com/google/clasp"><img src="https://img.shields.io/badge/built%20with-clasp-4285f4.svg" alt="clasp"></a>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# SettingsService

<div id="badges" align="left">
<img src="https://img.shields.io/github/v/release/MaksymStoianov/SettingsService" alt="Release">
<a href="LICENSE.md"><img src="https://img.shields.io/github/license/MaksymStoianov/SettingsService" alt="License"></a>
<a href="https://github.com/google/clasp"><img src="https://img.shields.io/badge/built%20with-clasp-4285f4.svg" alt="clasp"></a>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/ru/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# SettingsService

<div id="badges" align="left">
<img src="https://img.shields.io/github/v/release/MaksymStoianov/SettingsService" alt="Release">
<a href="LICENSE.md"><img src="https://img.shields.io/github/license/MaksymStoianov/SettingsService" alt="License"></a>
<a href="https://github.com/google/clasp"><img src="https://img.shields.io/badge/built%20with-clasp-4285f4.svg" alt="clasp"></a>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/uk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# SettingsService

<div id="badges" align="left">
<img src="https://img.shields.io/github/v/release/MaksymStoianov/SettingsService" alt="Release">
<a href="LICENSE.md"><img src="https://img.shields.io/github/license/MaksymStoianov/SettingsService" alt="License"></a>
<a href="https://github.com/google/clasp"><img src="https://img.shields.io/badge/built%20with-clasp-4285f4.svg" alt="clasp"></a>
</div>
Expand Down
37 changes: 36 additions & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,47 @@ SettingsService.Settings = class Settings {



/**
* Вызывается при преобразовании объекта в соответствующее примитивное значение.
* @param {string} hint Строковый аргумент, который передаёт желаемый тип примитива: `string`, `number` или `default`.
* @return {string}
*/
[Symbol.toPrimitive](hint) {
if (hint !== 'string') {
return null;
}

return this.constructor.name;
}



/**
* Возвращает значение текущего объекта.
* @return {string}
*/
valueOf() {
return (this[Symbol.toPrimitive] ? this[Symbol.toPrimitive]() : this.constructor.name);
}



/**
* Геттер для получения строки, представляющей тег объекта.
* @return {string} Имя класса текущего объекта, используемое в `Object.prototype.toString`.
*/
get [Symbol.toStringTag]() {
return this.constructor.name;
}



/**
* Возвращает строку, представляющую объект.
* @return {string}
*/
toString() {
return this.constructor.name;
return (this[Symbol.toPrimitive] ? this[Symbol.toPrimitive]('string') : this.constructor.name);
}

};

0 comments on commit 2642037

Please sign in to comment.