Skip to content

Commit a7ea2a2

Browse files
committed
Fixed U.keywords().
1 parent b8c5824 commit a7ea2a2

3 files changed

Lines changed: 5 additions & 25 deletions

File tree

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
- fixed: (IMPORTANT) SchemaBuilder validation
1919
- fixed: (IMPORTANT) view caching
20+
- fixed: (IMPORTANT) U.keywords()
2021
- fixed: binary / executable for Windows
2122
- fixed: SUCCESS()
2223
- fixed: Schema Validation is performed after F.onAuthorize().

test/test-tmp.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
require('../index');
22

3-
NEWSCHEMA('B').make(function(schema) {
4-
schema.define('name', String, true);
5-
});
3+
var a = 'asdas\nds\na\nsa\nsad';
64

7-
NEWSCHEMA('C').make(function(schema) {
8-
schema.define('name', String, true);
9-
});
10-
11-
NEWSCHEMA('A').make(function(schema) {
12-
schema.define('name', String, true);
13-
schema.define('subB', '[B]');
14-
schema.define('subC', 'C');
15-
});
16-
17-
var obj = {};
18-
obj.name = 'asdas';
19-
obj.subB = [{}];
20-
obj.subC = { A: '' };
21-
22-
GETSCHEMA('A').make(obj, function(err, res) {
23-
console.log('------');
24-
err.setPrefix('error-');
25-
console.log(err.output());
26-
});
5+
console.log(U.keywords(a, true, true));

utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,14 @@ exports.keywords = function(content, forSearch, alternative, max_count, max_leng
360360
for (var i = 0, length = content.length; i < length; i++) {
361361
if (!content[i])
362362
continue;
363-
var tmp = (forSearch ? content[i].removeDiacritics().toLowerCase().replace(/y/g, 'i') : content[i].toLowerCase()).split(' ');
363+
var tmp = (forSearch ? content[i].removeDiacritics().toLowerCase().replace(/y/g, 'i') : content[i].toLowerCase()).replace(/\n/g, ' ').split(' ');
364364
if (!tmp || !tmp.length)
365365
continue;
366366
for (var j = 0, jl = tmp.length; j < jl; j++)
367367
words.push(tmp[j]);
368368
}
369369
} else
370-
words = (forSearch ? content.removeDiacritics().toLowerCase().replace(/y/g, 'i') : content.toLowerCase()).split(' ');
370+
words = (forSearch ? content.removeDiacritics().toLowerCase().replace(/y/g, 'i') : content.toLowerCase()).replace(/\n/g, ' ').split(' ');
371371

372372
if (!words)
373373
words = [];

0 commit comments

Comments
 (0)