Skip to content

Commit a5e29b8

Browse files
committed
Getters return read-only copies
1 parent d65fb46 commit a5e29b8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

modules/stores/ActiveStore.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
var mergeProperties = require('../helpers/mergeProperties');
2+
13
var _activeRoutes = [];
24
var _activeParams = {};
35
var _activeQuery = {};
@@ -69,24 +71,24 @@ var ActiveStore = {
6971
},
7072

7173
/**
72-
* Returns an array of the currently active routes.
74+
* Returns a read-only array of the currently active routes.
7375
*/
7476
getActiveRoutes: function () {
75-
return _activeRoutes;
77+
return _activeRoutes.slice(0);
7678
},
7779

7880
/**
79-
* Returns a hash of the currently active params.
81+
* Returns a read-only hash of the currently active params.
8082
*/
8183
getActiveParams: function () {
82-
return _activeParams;
84+
return mergeProperties({}, _activeParams);
8385
},
8486

8587
/**
86-
* Returns a hash of the currently active query parameters.
88+
* Returns a read-only hash of the currently active query parameters.
8789
*/
8890
getActiveQuery: function () {
89-
return _activeQuery;
91+
return mergeProperties({}, _activeQuery);
9092
},
9193

9294
/**

0 commit comments

Comments
 (0)