Skip to content

Commit

Permalink
Add pName param to removeIcon API
Browse files Browse the repository at this point in the history
  • Loading branch information
doubleactii committed Feb 25, 2024
1 parent ffcaeb1 commit 4562194
Show file tree
Hide file tree
Showing 10 changed files with 4,555 additions and 3,771 deletions.
1,528 changes: 764 additions & 764 deletions docs/ast/source/icon.mjs.json

Large diffs are not rendered by default.

6,669 changes: 3,712 additions & 2,957 deletions docs/ast/source/vyi.mjs.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/class/src/icon.mjs~Icon.html
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ <h1 data-ice="name">Icon</h1>
<div>


<div data-ice="description"><p>Removes the frame from this icon via passed frame reference or via index passed.</p>
<div data-ice="description"><p>Removes the frame passed or the frame that exists at pIndex.</p>
</div>
</div>
</td>
Expand Down Expand Up @@ -666,7 +666,7 @@ <h1 data-ice="name">Icon</h1>
<div>


<div data-ice="description"><p>Removes the state with the name pName.</p>
<div data-ice="description"><p>Removes the state passed or the state with the name pName.</p>
</div>
</div>
</td>
Expand Down Expand Up @@ -2073,7 +2073,7 @@ <h3 data-ice="anchor" id="instance-method-removeFrame">



<div data-ice="description"><p>Removes the frame from this icon via passed frame reference or via index passed.</p>
<div data-ice="description"><p>Removes the frame passed or the frame that exists at pIndex.</p>
</div>


Expand Down Expand Up @@ -2154,7 +2154,7 @@ <h3 data-ice="anchor" id="instance-method-removeState">



<div data-ice="description"><p>Removes the state with the name pName.</p>
<div data-ice="description"><p>Removes the state passed or the state with the name pName.</p>
</div>


Expand Down
27 changes: 17 additions & 10 deletions docs/class/src/vyi.mjs~VYI.html
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,13 @@ <h1 data-ice="name">VYI</h1>



<span class="code" data-ice="name"><span><a href="class/src/vyi.mjs~VYI.html#instance-method-removeIcon">removeIcon</a></span></span><span class="code" data-ice="signature">(-: <span><a href="class/src/icon.mjs~Icon.html">Icon</a></span>)</span>
<span class="code" data-ice="name"><span><a href="class/src/vyi.mjs~VYI.html#instance-method-removeIcon">removeIcon</a></span></span><span class="code" data-ice="signature">(pIcon: <span><a href="class/src/icon.mjs~Icon.html">Icon</a></span>, pName: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>)</span>
</p>
</div>
<div>


<div data-ice="description"><p>Removes the icon from this VYI.</p>
<div data-ice="description"><p>Removes the icon passed or the icon with the name pName.</p>
</div>
</div>
</td>
Expand Down Expand Up @@ -842,7 +842,7 @@ <h3 data-ice="anchor" id="instance-method-export">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber147">source</a></span></span>
<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber151">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -899,7 +899,7 @@ <h3 data-ice="anchor" id="instance-method-getIcon">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber135">source</a></span></span>
<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber139">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -973,7 +973,7 @@ <h3 data-ice="anchor" id="instance-method-getIconNames">
<span class="right-info">


<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber122">source</a></span></span>
<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber126">source</a></span></span>
</span>
</h3>

Expand Down Expand Up @@ -1088,18 +1088,18 @@ <h3 data-ice="anchor" id="instance-method-removeIcon">



<span class="code" data-ice="name">removeIcon</span><span class="code" data-ice="signature">(-: <span><a href="class/src/icon.mjs~Icon.html">Icon</a></span>)</span>
<span class="code" data-ice="name">removeIcon</span><span class="code" data-ice="signature">(pIcon: <span><a href="class/src/icon.mjs~Icon.html">Icon</a></span>, pName: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>)</span>
<span class="right-info">


<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber113">source</a></span></span>
<span data-ice="source"><span><a href="file/src/vyi.mjs.html#lineNumber114">source</a></span></span>
</span>
</h3>




<div data-ice="description"><p>Removes the icon from this VYI.</p>
<div data-ice="description"><p>Removes the icon passed or the icon with the name pName.</p>
</div>


Expand All @@ -1113,10 +1113,17 @@ <h4 data-ice="title">Params:</h4>
<tbody>

<tr data-ice="property" data-depth="0">
<td data-ice="name" class="code" data-depth="0">-</td>
<td data-ice="name" class="code" data-depth="0">pIcon</td>
<td data-ice="type" class="code"><span><a href="class/src/icon.mjs~Icon.html">Icon</a></span></td>
<td data-ice="appendix"></td>
<td data-ice="description"><p>The icon to remove.</p>
<td data-ice="description"><p>The state to remove from this icon. pName should be not be used in tandem with this method of removing.</p>
</td>
</tr>
<tr data-ice="property" data-depth="0">
<td data-ice="name" class="code" data-depth="0">pName</td>
<td data-ice="type" class="code"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></td>
<td data-ice="appendix"></td>
<td data-ice="description"><p>The name of the icon to remove. pIcon must be undefined to use this method for removing.</p>
</td>
</tr>
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions docs/file/src/icon.mjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
}
}
/**
* Removes the state with the name pName.
* Removes the state passed or the state with the name pName.
* @param {Icon} pState - The state to remove from this icon. pName should be not be used in tandem with this method of removing.
* @param {string} pName - The name of the state to remove. pState must be undefined to use this method for removing.
* @returns {self} This icon instance.
Expand Down Expand Up @@ -315,7 +315,7 @@
}
}
/**
* Removes the frame from this icon via passed frame reference or via index passed.
* Removes the frame passed or the frame that exists at pIndex.
* @param {Frame} pFrame - The frame to remove from this icon. pIndex should be not be used in tandem with this method of removing.
* @param {number} pIndex - The index of the frame to remove. pFrame must be undefined to use this method for removing.
* @returns {self} This icon instance.
Expand Down
14 changes: 9 additions & 5 deletions docs/file/src/vyi.mjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,16 @@
}
}
/**
* Removes the icon from this VYI.
* @param {Icon} - The icon to remove.
* Removes the icon passed or the icon with the name pName.
* @param {Icon} pIcon - The state to remove from this icon. pName should be not be used in tandem with this method of removing.
* @param {string} pName - The name of the icon to remove. pIcon must be undefined to use this method for removing.
*/
removeIcon(pIcon) {
if (this.icons.includes(pIcon)) {
this.icons.splice(this.icons.indexOf(pIcon), 1);
removeIcon(pIcon, pName) {
const icon = pIcon || this.getIcon(pName);
if (icon) {
if (this.icons.includes(icon)) {
this.icons.splice(this.icons.indexOf(icon), 1);
}
}
}
/**
Expand Down
32 changes: 21 additions & 11 deletions docs/index.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@
<td class="coverage"><span data-ice="coverage">-</span></td>
<td style="display: none;" data-ice="size">3433 byte</td>
<td style="display: none;" data-ice="lines">118</td>
<td style="display: none;" data-ice="updated">2024-02-01 23:08:06 (UTC)</td>
<td style="display: none;" data-ice="updated">2024-02-01 23:13:05 (UTC)</td>
</tr>
<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/src/icon.mjs.html">src/icon.mjs</a></span></td>
<td data-ice="identifier" class="identifiers"><span><a href="class/src/icon.mjs~Icon.html">Icon</a></span></td>
<td class="coverage"><span data-ice="coverage">-</span></td>
<td style="display: none;" data-ice="size">17360 byte</td>
<td style="display: none;" data-ice="lines">487</td>
<td style="display: none;" data-ice="updated">2024-02-01 23:10:42 (UTC)</td>
<td style="display: none;" data-ice="updated">2024-02-01 23:24:16 (UTC)</td>
</tr>
<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/src/vyi.mjs.html">src/vyi.mjs</a></span></td>
<td data-ice="identifier" class="identifiers"><span><a href="class/src/vyi.mjs~VYI.html">VYI</a></span></td>
<td class="coverage"><span data-ice="coverage">-</span></td>
<td style="display: none;" data-ice="size">5345 byte</td>
<td style="display: none;" data-ice="lines">158</td>
<td style="display: none;" data-ice="updated">2024-02-01 21:53:20 (UTC)</td>
<td style="display: none;" data-ice="size">5682 byte</td>
<td style="display: none;" data-ice="lines">162</td>
<td style="display: none;" data-ice="updated">2024-02-01 23:25:41 (UTC)</td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 2 additions & 2 deletions src/icon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class Icon {
}
}
/**
* Removes the state with the name pName.
* Removes the state passed or the state with the name pName.
* @param {Icon} pState - The state to remove from this icon. pName should be not be used in tandem with this method of removing.
* @param {string} pName - The name of the state to remove. pState must be undefined to use this method for removing.
* @returns {self} This icon instance.
Expand Down Expand Up @@ -276,7 +276,7 @@ export class Icon {
}
}
/**
* Removes the frame from this icon via passed frame reference or via index passed.
* Removes the frame passed or the frame that exists at pIndex.
* @param {Frame} pFrame - The frame to remove from this icon. pIndex should be not be used in tandem with this method of removing.
* @param {number} pIndex - The index of the frame to remove. pFrame must be undefined to use this method for removing.
* @returns {self} This icon instance.
Expand Down
30 changes: 19 additions & 11 deletions src/vyi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ export class VYI {
}
}
/**
* Removes the icon from this VYI.
* @param {Icon} - The icon to remove.
* Removes the icon passed or the icon with the name pName.
* @param {Icon} pIcon - The state to remove from this icon. pName should be not be used in tandem with this method of removing.
* @param {string} pName - The name of the icon to remove. pIcon must be undefined to use this method for removing.
*/
removeIcon(pIcon) {
if (this.icons.includes(pIcon)) {
this.icons.splice(this.icons.indexOf(pIcon), 1);
removeIcon(pIcon, pName) {
const icon = pIcon || this.getIcon(pName);
if (icon) {
if (this.icons.includes(icon)) {
this.icons.splice(this.icons.indexOf(icon), 1);
}
}
}
/**
Expand All @@ -133,12 +137,16 @@ export class VYI {
* @returns {Icon|undefined} The icon that has the name pName or undefined.
*/
getIcon(pName) {
for (const icon of this.icons) {
// If the icon has the same name, return that icon
if (icon.getName() === pName) {
return icon;
}
};
if (typeof(pName) === 'string') {
for (const icon of this.icons) {
// If the icon has the same name, return that icon
if (icon.getName() === pName) {
return icon;
}
};
} else {
this.logger.prefix('VYI-module').error('Invalid name type used!');
}
}
/**
* Exports this VYI into VYI format.
Expand Down

0 comments on commit 4562194

Please sign in to comment.