Files
kami-parse-server/src/LiveQuery/Id.js
wangmengyan95 555e25bf33 Add LiveQuery
2016-03-18 12:32:31 -07:00

23 lines
490 B
JavaScript

class Id {
className: string;
objectId: string;
constructor(className: string, objectId: string) {
this.className = className;
this.objectId = objectId;
}
toString(): string {
return this.className + ':' + this.objectId;
}
static fromString(str: string) {
var split = str.split(':');
if (split.length !== 2) {
throw new TypeError('Cannot create Id object from this string');
}
return new Id(split[0], split[1]);
}
}
module.exports = Id;