mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-12 15:24:18 +00:00
Use regex instead of simple substring (#2075)
This commit is contained in:
parent
142c626e4f
commit
7cc4e0feee
@ -5,7 +5,7 @@ x.x.x Release notes (yyyy-MM-dd)
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
|
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
|
||||||
* None.
|
* Fixed an incorrect property named returned from `Realm.subscriptions()`. (since v2.19.0-rc.2)
|
||||||
|
|
||||||
### Compatibility
|
### Compatibility
|
||||||
* Realm Object Server: 3.11.0 or later.
|
* Realm Object Server: 3.11.0 or later.
|
||||||
|
@ -27,6 +27,8 @@ let getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function(obj
|
|||||||
}, {});
|
}, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const subscriptionObjectNameRegex = /^(class_)?(.*?)(_matches)?$/gm;
|
||||||
|
|
||||||
function setConstructorOnPrototype(klass) {
|
function setConstructorOnPrototype(klass) {
|
||||||
if (klass.prototype.constructor !== klass) {
|
if (klass.prototype.constructor !== klass) {
|
||||||
Object.defineProperty(klass.prototype, 'constructor', { value: klass, configurable: true, writable: true });
|
Object.defineProperty(klass.prototype, 'constructor', { value: klass, configurable: true, writable: true });
|
||||||
@ -393,7 +395,7 @@ module.exports = function(realmConstructor) {
|
|||||||
let matches_property = subscription['matches_property'];
|
let matches_property = subscription['matches_property'];
|
||||||
let sub = {
|
let sub = {
|
||||||
name: subscription['name'],
|
name: subscription['name'],
|
||||||
objectType: matches_property.substr(0, matches_property.length-8), // remove _matches
|
objectType: matches_property.replace(subscriptionObjectNameRegex, '$2'),
|
||||||
query: subscription['query'],
|
query: subscription['query'],
|
||||||
}
|
}
|
||||||
listOfSubscriptions.push(sub);
|
listOfSubscriptions.push(sub);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user