This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| smutbook:classes:util:array_prototypes [2026/08/25 12:45] – lee | smutbook:classes:util:array_prototypes [2026/08/25 13:58] (current) – removed lee | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Array Prototypes ====== | ||
| - | |||
| - | ===== Array.prototype.commaList() ===== | ||
| - | |||
| - | Returns a proper serial-comma-separated string list of the list elements' | ||
| - | < | ||
| - | // Returns "a two-dollar pistol, a Stetson hat, and a shotgun": | ||
| - | [ "a two-dollar pistol", | ||
| - | |||
| - | // Returns "a two-dollar pistol and a Stetson hat": | ||
| - | [ "a two-dollar pistol", | ||
| - | |||
| - | // Returns "a two-dollar pistol": | ||
| - | [ "a two-dollar pistol" | ||
| - | |||
| - | // Returns " | ||
| - | [].commaList() | ||
| - | </ | ||
| - | |||
| - | ===== Array.prototype.CommaList() ===== | ||
| - | |||
| - | As above, but with the first letter of the returned string capitalized. | ||
| - | |||
| - | ===== Array.prototype.aList ===== | ||
| - | |||
| - | Assuming an array of PersistentObjects (or subclasses thereof) or persistent object IDs (may be mixed), returns a serial-comma-separated description like .commaList(), | ||
| - | < | ||
| - | // Assuming pistol and shotgun are valid PersistentObjects, | ||
| - | // PersistentObject, | ||
| - | [ pistol, " | ||
| - | </ | ||
| - | |||
| - | ===== Array.prototype.AList() ===== | ||
| - | |||
| - | As above, but with the first letter of the returned string capitalized. | ||
| - | |||
| - | ===== Array.prototype.theList ===== | ||
| - | |||
| - | Assuming an array of PersistentObjects (or subclasses thereof) or persistent object IDs (may be mixed), returns a serial-comma-separated description like .commaList(), | ||
| - | < | ||
| - | // Assuming pistol and shotgun are valid PersistentObjects, | ||
| - | // PersistentObject, | ||
| - | [ pistol, " | ||
| - | </ | ||
| - | |||
| - | ===== Array.prototype.TheList() ===== | ||
| - | |||
| - | As above, but with the first letter of the returned string capitalized. | ||
| - | |||
| - | ===== Array.prototype.nList ===== | ||
| - | |||
| - | Assuming an array of PersistentObjects (or subclasses thereof), or persistent object IDs, or functions (may be mixed), returns a serial-comma-separated description like .commaList(), | ||
| - | < | ||
| - | // Assuming pistol and shotgun are valid PersistentObjects, | ||
| - | // PersistentObject, | ||
| - | [ pistol, " | ||
| - | </ | ||
| - | |||
| - | ===== Array.prototype.NList() ===== | ||
| - | |||
| - | As above, but with the first letter of the returned string capitalized. | ||
| - | |||