@naturalcycles/js-lib
Version:
Standard library for universal (browser + Node.js) javascript
20 lines (19 loc) • 388 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Set2 = void 0;
/**
* Like Set, but serializes to JSON as an array.
*
* Fixes the "issue" of stock Set being json-serialized as `{}`.
*
* @experimental
*/
class Set2 extends Set {
toArray() {
return [...this];
}
toJSON() {
return [...this];
}
}
exports.Set2 = Set2;