Skip to content

Commit 72d398d

Browse files
committed
Tighten up scope of when component is applied
1 parent 185e96f commit 72d398d

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

lib/deserialize.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ module.exports = function (app) {
1212
app.remotes().before('**', function (ctx, next) {
1313
var data, serverRelations, errors;
1414
var regexs = [
15-
/\.create/,
16-
/prototype\.updateAttributes/,
17-
/prototype\.__createRelationships__/,
18-
/prototype\.__updateRelationships__/
15+
/^create$/,
16+
/^updateAttributes$/
1917
];
2018

2119
var matches = regexs.filter(function (regex) {
22-
return ctx.methodString.match(regex);
20+
return regex.test(ctx.method.name);
2321
});
2422

2523
if (matches.length > 0) {

lib/serialize.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ var serializer = require('./serializer');
33
var utils = require('./utils');
44
var _ = require('lodash');
55
var regexs = [
6-
/\.find/,
7-
/\.create/,
8-
/\.deleteById/,
9-
/\.findById/,
10-
/prototype\.__get__/,
11-
/prototype\.updateAttributes/,
12-
/prototype\.__findRelationships__/,
13-
/prototype\.__createRelationships__/,
14-
/prototype\.__updateRelationships__/
6+
/^find$/,
7+
/^create$/,
8+
/^deleteById$/,
9+
/^findById$/,
10+
/^__get__.*/,
11+
/^updateAttributes$/,
12+
/^__findRelationships__.*/
1513
];
1614

1715
module.exports = function (app, defaults) {
@@ -27,7 +25,7 @@ module.exports = function (app, defaults) {
2725
requestedIncludes;
2826

2927
var matches = regexs.filter(function (regex) {
30-
return ctx.methodString.match(regex);
28+
return regex.test(ctx.method.name);
3129
});
3230

3331
if (!matches.length) {

0 commit comments

Comments
 (0)