@polkadot/types-codec
Version:
Implementation of the SCALE codec
43 lines (42 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Range = void 0;
const Tuple_js_1 = require("../base/Tuple.js");
/**
* @name Range
* @description
* Rust `Range<T>` representation
*/
class Range extends Tuple_js_1.Tuple {
__internal__rangeName;
constructor(registry, Type, value, { rangeName = 'Range' } = {}) {
super(registry, [Type, Type], value);
this.__internal__rangeName = rangeName;
}
static with(Type) {
return class extends Range {
constructor(registry, value) {
super(registry, Type, value);
}
};
}
/**
* @description Returns the starting range value
*/
get start() {
return this[0];
}
/**
* @description Returns the ending range value
*/
get end() {
return this[1];
}
/**
* @description Returns the base runtime type name for this instance
*/
toRawType() {
return `${this.__internal__rangeName}<${this.start.toRawType()}>`;
}
}
exports.Range = Range;