Skip to content

Commit 5afb475

Browse files
author
guyonroche
committed
Testing...
1 parent 878a994 commit 5afb475

10 files changed

+1340
-1096
lines changed

.jshintrc

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"curly": true,
3+
"eqeqeq": true,
4+
"immed": true,
5+
"newcap": true,
6+
"noarg": true,
7+
"undef": true,
8+
"unused": false,
9+
"node": true ,
10+
"bitwise": true,
11+
"indent": 2,
12+
"noempty": true,
13+
"quotmark": "single",
14+
"strict": true,
15+
"trailing": true,
16+
"forin": true,
17+
"camelcase": false,
18+
"jasmine": true,
19+
"latedef": true,
20+
"globals": {
21+
"describe": false,
22+
"it": false,
23+
"unescape": false
24+
},
25+
"esnext": true
26+
}

lib/doc/defined-names.js

+19-11
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ DefinedNames.prototype = {
6161
}
6262
},
6363

64+
remove: function(locStr, name) {
65+
var location = colCache.decodeEx(locStr);
66+
this.removeEx(location, name);
67+
},
6468
removeEx: function(location, name) {
6569
var matrix = this.getMatrix(name);
6670
matrix.removeCellEx(location);
@@ -132,16 +136,13 @@ DefinedNames.prototype = {
132136
return dimensions;
133137
},
134138

135-
get model() {
139+
getRanges: function(name, matrix) {
136140
var self = this;
141+
matrix = matrix || this.matrixMap[name];
137142

138-
// Rethink!
139-
// Have cell-matrix per name! Easy to serialise
140-
// To get names per cell - just iterate over all names finding cells if they exist
141-
return _.map(this.matrixMap, function(matrix, name) {
142-
// mark and sweep!
143-
matrix.forEach(function(cell) { cell.mark = true; });
144-
var ranges = matrix.map(function(cell) {
143+
// mark and sweep!
144+
matrix.forEach(function(cell) { cell.mark = true; });
145+
var ranges = matrix.map(function(cell) {
145146
if (cell.mark) {
146147
var dimensions = self._explore(matrix, cell);
147148
var range = cell.sheetName + '!' + (dimensions.count > 1 ? dimensions.$range : dimensions.$t$l);
@@ -150,9 +151,16 @@ DefinedNames.prototype = {
150151
})
151152
.filter(function(range) { return range; });
152153

153-
return {
154-
name: name, ranges: ranges
155-
};
154+
return {
155+
name: name, ranges: ranges
156+
};
157+
},
158+
159+
get model() {
160+
var self = this;
161+
// To get names per cell - just iterate over all names finding cells if they exist
162+
return _.map(this.matrixMap, function(matrix, name) {
163+
return self.getRanges(name, matrix);
156164
});
157165
},
158166
set model(value) {

0 commit comments

Comments
 (0)