react-select-fast-filter-options
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -0,1 +1,4 @@ | ||
##### 0.2.2 | ||
Remove unnecessary `babelHelpers` from ES modules. | ||
##### 0.2.1 | ||
@@ -2,0 +5,0 @@ Patch to fix previous bad build. |
@@ -6,5 +6,2 @@ 'use strict'; | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = createFilterOptions; | ||
@@ -55,15 +52,9 @@ | ||
if (Array.isArray(selectedOptions) && selectedOptions.length) { | ||
var _ret = function () { | ||
var selectedValues = selectedOptions.map(function (option) { | ||
return option[valueKey]; | ||
}); | ||
var selectedValues = selectedOptions.map(function (option) { | ||
return option[valueKey]; | ||
}); | ||
return { | ||
v: filtered.filter(function (option) { | ||
return !selectedValues.includes(option[valueKey]); | ||
}) | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
return filtered.filter(function (option) { | ||
return !selectedValues.includes(option[valueKey]); | ||
}); | ||
} | ||
@@ -70,0 +61,0 @@ |
@@ -44,15 +44,9 @@ import { AllSubstringsIndexStrategy, Search, UnorderedSearchIndex } from 'js-search'; | ||
if (Array.isArray(selectedOptions) && selectedOptions.length) { | ||
var _ret = function () { | ||
var selectedValues = selectedOptions.map(function (option) { | ||
return option[valueKey]; | ||
}); | ||
var selectedValues = selectedOptions.map(function (option) { | ||
return option[valueKey]; | ||
}); | ||
return { | ||
v: filtered.filter(function (option) { | ||
return !selectedValues.includes(option[valueKey]); | ||
}) | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === "object") return _ret.v; | ||
return filtered.filter(function (option) { | ||
return !selectedValues.includes(option[valueKey]); | ||
}); | ||
} | ||
@@ -59,0 +53,0 @@ |
@@ -82,13 +82,8 @@ !function(root, factory) { | ||
if (Array.isArray(selectedOptions) && selectedOptions.length) { | ||
var _ret = function() { | ||
var selectedValues = selectedOptions.map(function(option) { | ||
return option[valueKey]; | ||
}); | ||
return { | ||
v: filtered.filter(function(option) { | ||
return !selectedValues.includes(option[valueKey]); | ||
}) | ||
}; | ||
}(); | ||
if ("object" === ("undefined" == typeof _ret ? "undefined" : _typeof(_ret))) return _ret.v; | ||
var selectedValues = selectedOptions.map(function(option) { | ||
return option[valueKey]; | ||
}); | ||
return filtered.filter(function(option) { | ||
return !selectedValues.includes(option[valueKey]); | ||
}); | ||
} | ||
@@ -100,381 +95,1017 @@ return filtered; | ||
value: !0 | ||
}); | ||
var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { | ||
return typeof obj; | ||
} : function(obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
exports.default = createFilterOptions; | ||
}), exports.default = createFilterOptions; | ||
var _jsSearch = __webpack_require__(1); | ||
}, /* 1 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _index = __webpack_require__(2); | ||
Object.defineProperty(exports, "AllSubstringsIndexStrategy", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index.AllSubstringsIndexStrategy; | ||
} | ||
}), Object.defineProperty(exports, "ExactWordIndexStrategy", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index.ExactWordIndexStrategy; | ||
} | ||
}), Object.defineProperty(exports, "PrefixIndexStrategy", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index.PrefixIndexStrategy; | ||
} | ||
}); | ||
var _index2 = __webpack_require__(6); | ||
Object.defineProperty(exports, "CaseSensitiveSanitizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index2.CaseSensitiveSanitizer; | ||
} | ||
}), Object.defineProperty(exports, "LowerCaseSanitizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index2.LowerCaseSanitizer; | ||
} | ||
}); | ||
var _index3 = __webpack_require__(9); | ||
Object.defineProperty(exports, "TfIdfSearchIndex", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index3.TfIdfSearchIndex; | ||
} | ||
}), Object.defineProperty(exports, "UnorderedSearchIndex", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index3.UnorderedSearchIndex; | ||
} | ||
}); | ||
var _index4 = __webpack_require__(13); | ||
Object.defineProperty(exports, "SimpleTokenizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index4.SimpleTokenizer; | ||
} | ||
}), Object.defineProperty(exports, "StemmingTokenizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index4.StemmingTokenizer; | ||
} | ||
}), Object.defineProperty(exports, "StopWordsTokenizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _index4.StopWordsTokenizer; | ||
} | ||
}); | ||
var _Search = __webpack_require__(18); | ||
Object.defineProperty(exports, "Search", { | ||
enumerable: !0, | ||
get: function() { | ||
return _Search.Search; | ||
} | ||
}); | ||
var _StopWordsMap = __webpack_require__(17); | ||
Object.defineProperty(exports, "StopWordsMap", { | ||
enumerable: !0, | ||
get: function() { | ||
return _StopWordsMap.StopWordsMap; | ||
} | ||
}); | ||
var _TokenHighlighter = __webpack_require__(19); | ||
Object.defineProperty(exports, "TokenHighlighter", { | ||
enumerable: !0, | ||
get: function() { | ||
return _TokenHighlighter.TokenHighlighter; | ||
} | ||
}); | ||
}, /* 2 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _AllSubstringsIndexStrategy = __webpack_require__(3); | ||
Object.defineProperty(exports, "AllSubstringsIndexStrategy", { | ||
enumerable: !0, | ||
get: function() { | ||
return _AllSubstringsIndexStrategy.AllSubstringsIndexStrategy; | ||
} | ||
}); | ||
var _ExactWordIndexStrategy = __webpack_require__(4); | ||
Object.defineProperty(exports, "ExactWordIndexStrategy", { | ||
enumerable: !0, | ||
get: function() { | ||
return _ExactWordIndexStrategy.ExactWordIndexStrategy; | ||
} | ||
}); | ||
var _PrefixIndexStrategy = __webpack_require__(5); | ||
Object.defineProperty(exports, "PrefixIndexStrategy", { | ||
enumerable: !0, | ||
get: function() { | ||
return _PrefixIndexStrategy.PrefixIndexStrategy; | ||
} | ||
}); | ||
}, /* 3 */ | ||
/***/ | ||
function(module, exports) { | ||
/// <reference path="index-strategy.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var AllSubstringsIndexStrategy = function() { | ||
function AllSubstringsIndexStrategy() {} | ||
return AllSubstringsIndexStrategy.prototype.expandToken = function(token) { | ||
for (var expandedTokens = [], i = 0, length = token.length; i < length; ++i) for (var j = i; j < length; ++j) expandedTokens.push(token.substring(i, j + 1)); | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(); | ||
exports.AllSubstringsIndexStrategy = function() { | ||
function AllSubstringsIndexStrategy() { | ||
_classCallCheck(this, AllSubstringsIndexStrategy); | ||
} | ||
return _createClass(AllSubstringsIndexStrategy, [ { | ||
key: "expandToken", | ||
/** | ||
* @inheritDocs | ||
*/ | ||
value: function(token) { | ||
for (var string, expandedTokens = [], i = 0, length = token.length; i < length; ++i) { | ||
string = ""; | ||
for (var j = i; j < length; ++j) string += token.charAt(j), expandedTokens.push(string); | ||
} | ||
return expandedTokens; | ||
}, AllSubstringsIndexStrategy; | ||
}(); | ||
JsSearch.AllSubstringsIndexStrategy = AllSubstringsIndexStrategy; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=all-substrings-index-strategy.js.map | ||
/// <reference path="index-strategy.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var ExactWordIndexStrategy = function() { | ||
function ExactWordIndexStrategy() {} | ||
return ExactWordIndexStrategy.prototype.expandToken = function(token) { | ||
} | ||
} ]), AllSubstringsIndexStrategy; | ||
}(); | ||
}, /* 4 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(); | ||
exports.ExactWordIndexStrategy = function() { | ||
function ExactWordIndexStrategy() { | ||
_classCallCheck(this, ExactWordIndexStrategy); | ||
} | ||
return _createClass(ExactWordIndexStrategy, [ { | ||
key: "expandToken", | ||
/** | ||
* @inheritDocs | ||
*/ | ||
value: function(token) { | ||
return token ? [ token ] : []; | ||
}, ExactWordIndexStrategy; | ||
}(); | ||
JsSearch.ExactWordIndexStrategy = ExactWordIndexStrategy; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=exact-word-index-strategy.js.map | ||
var JsSearch; | ||
!function(JsSearch) {}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=index-strategy.js.map | ||
/// <reference path="index-strategy.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var PrefixIndexStrategy = function() { | ||
function PrefixIndexStrategy() {} | ||
return PrefixIndexStrategy.prototype.expandToken = function(token) { | ||
for (var expandedTokens = [], i = 0, length = token.length; i < length; ++i) expandedTokens.push(token.substring(0, i + 1)); | ||
} | ||
} ]), ExactWordIndexStrategy; | ||
}(); | ||
}, /* 5 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(); | ||
exports.PrefixIndexStrategy = function() { | ||
function PrefixIndexStrategy() { | ||
_classCallCheck(this, PrefixIndexStrategy); | ||
} | ||
return _createClass(PrefixIndexStrategy, [ { | ||
key: "expandToken", | ||
/** | ||
* @inheritDocs | ||
*/ | ||
value: function(token) { | ||
for (var expandedTokens = [], string = "", i = 0, length = token.length; i < length; ++i) string += token.charAt(i), | ||
expandedTokens.push(string); | ||
return expandedTokens; | ||
}, PrefixIndexStrategy; | ||
}(); | ||
JsSearch.PrefixIndexStrategy = PrefixIndexStrategy; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=prefix-index-strategy.js.map | ||
/// <reference path="sanitizer.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var CaseSensitiveSanitizer = function() { | ||
function CaseSensitiveSanitizer() {} | ||
return CaseSensitiveSanitizer.prototype.sanitize = function(text) { | ||
} | ||
} ]), PrefixIndexStrategy; | ||
}(); | ||
}, /* 6 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _CaseSensitiveSanitizer = __webpack_require__(7); | ||
Object.defineProperty(exports, "CaseSensitiveSanitizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _CaseSensitiveSanitizer.CaseSensitiveSanitizer; | ||
} | ||
}); | ||
var _LowerCaseSanitizer = __webpack_require__(8); | ||
Object.defineProperty(exports, "LowerCaseSanitizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _LowerCaseSanitizer.LowerCaseSanitizer; | ||
} | ||
}); | ||
}, /* 7 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(); | ||
exports.CaseSensitiveSanitizer = function() { | ||
function CaseSensitiveSanitizer() { | ||
_classCallCheck(this, CaseSensitiveSanitizer); | ||
} | ||
return _createClass(CaseSensitiveSanitizer, [ { | ||
key: "sanitize", | ||
/** | ||
* @inheritDocs | ||
*/ | ||
value: function(text) { | ||
return text ? text.trim() : ""; | ||
}, CaseSensitiveSanitizer; | ||
}(); | ||
JsSearch.CaseSensitiveSanitizer = CaseSensitiveSanitizer; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=case-sensitive-sanitizer.js.map | ||
/// <reference path="sanitizer.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var LowerCaseSanitizer = function() { | ||
function LowerCaseSanitizer() {} | ||
return LowerCaseSanitizer.prototype.sanitize = function(text) { | ||
} | ||
} ]), CaseSensitiveSanitizer; | ||
}(); | ||
}, /* 8 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(); | ||
exports.LowerCaseSanitizer = function() { | ||
function LowerCaseSanitizer() { | ||
_classCallCheck(this, LowerCaseSanitizer); | ||
} | ||
return _createClass(LowerCaseSanitizer, [ { | ||
key: "sanitize", | ||
/** | ||
* @inheritDocs | ||
*/ | ||
value: function(text) { | ||
return text ? text.toLocaleLowerCase().trim() : ""; | ||
}, LowerCaseSanitizer; | ||
}(); | ||
JsSearch.LowerCaseSanitizer = LowerCaseSanitizer; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=lower-case-sanitizer.js.map | ||
var JsSearch; | ||
!function(JsSearch) {}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=sanitizer.js.map | ||
var JsSearch; | ||
!function(JsSearch) {}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=search-index.js.map | ||
/// <reference path="search-index.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var TfIdfSearchIndex = function() { | ||
function TfIdfSearchIndex(uidFieldName) { | ||
this.uidFieldName_ = uidFieldName, this.tokenToIdfCache_ = {}, this.tokenMap_ = {}; | ||
} | ||
return TfIdfSearchIndex.prototype.indexDocument = function(token, uid, document) { | ||
this.tokenToIdfCache_ = {}, this.tokenMap_[token] ? this.tokenMap_[token].$totalNumOccurrences++ : this.tokenMap_[token] = { | ||
} ]), LowerCaseSanitizer; | ||
}(); | ||
}, /* 9 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _TfIdfSearchIndex = __webpack_require__(10); | ||
Object.defineProperty(exports, "TfIdfSearchIndex", { | ||
enumerable: !0, | ||
get: function() { | ||
return _TfIdfSearchIndex.TfIdfSearchIndex; | ||
} | ||
}); | ||
var _UnorderedSearchIndex = __webpack_require__(12); | ||
Object.defineProperty(exports, "UnorderedSearchIndex", { | ||
enumerable: !0, | ||
get: function() { | ||
return _UnorderedSearchIndex.UnorderedSearchIndex; | ||
} | ||
}); | ||
}, /* 10 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}), exports.TfIdfSearchIndex = void 0; | ||
var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { | ||
return typeof obj; | ||
} : function(obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(), _getNestedFieldValue = __webpack_require__(11), _getNestedFieldValue2 = _interopRequireDefault(_getNestedFieldValue); | ||
exports.TfIdfSearchIndex = function() { | ||
function TfIdfSearchIndex(uidFieldName) { | ||
_classCallCheck(this, TfIdfSearchIndex), this._uidFieldName = uidFieldName, this._tokenToIdfCache = {}, | ||
this._tokenMap = {}; | ||
} | ||
/** | ||
* @inheritDocs | ||
*/ | ||
return _createClass(TfIdfSearchIndex, [ { | ||
key: "indexDocument", | ||
value: function(token, uid, doc) { | ||
this._tokenToIdfCache = {}; | ||
// New index invalidates previous IDF caches | ||
var tokenDatum, tokenMap = this._tokenMap; | ||
"object" !== _typeof(tokenMap[token]) ? tokenMap[token] = tokenDatum = { | ||
$numDocumentOccurrences: 0, | ||
$totalNumOccurrences: 1, | ||
$uidMap: {} | ||
}, this.tokenMap_[token].$uidMap[uid] ? this.tokenMap_[token].$uidMap[uid].$numTokenOccurrences++ : (this.tokenMap_[token].$numDocumentOccurrences++, | ||
this.tokenMap_[token].$uidMap[uid] = { | ||
$document: document, | ||
} : (tokenDatum = tokenMap[token], tokenDatum.$totalNumOccurrences++); | ||
var uidMap = tokenDatum.$uidMap; | ||
"object" !== _typeof(uidMap[uid]) ? (tokenDatum.$numDocumentOccurrences++, uidMap[uid] = { | ||
$document: doc, | ||
$numTokenOccurrences: 1 | ||
}); | ||
}, TfIdfSearchIndex.prototype.search = function(tokens, corpus) { | ||
}) : uidMap[uid].$numTokenOccurrences++; | ||
} | ||
}, { | ||
key: "search", | ||
value: function(tokens, corpus) { | ||
for (var uidToDocumentMap = {}, i = 0, numTokens = tokens.length; i < numTokens; i++) { | ||
var token = tokens[i], tokenMetadata = this.tokenMap_[token]; | ||
var token = tokens[i], tokenMetadata = this._tokenMap[token]; | ||
// Short circuit if no matches were found for any given token. | ||
if (!tokenMetadata) return []; | ||
if (0 === i) for (var uid in tokenMetadata.$uidMap) uidToDocumentMap[uid] = tokenMetadata.$uidMap[uid].$document; else for (var uid in uidToDocumentMap) tokenMetadata.$uidMap[uid] || delete uidToDocumentMap[uid]; | ||
if (0 === i) for (var keys = Object.keys(tokenMetadata.$uidMap), j = 0, numKeys = keys.length; j < numKeys; j++) { | ||
var uid = keys[j]; | ||
uidToDocumentMap[uid] = tokenMetadata.$uidMap[uid].$document; | ||
} else for (var keys = Object.keys(uidToDocumentMap), j = 0, numKeys = keys.length; j < numKeys; j++) { | ||
var uid = keys[j]; | ||
"object" !== _typeof(tokenMetadata.$uidMap[uid]) && delete uidToDocumentMap[uid]; | ||
} | ||
} | ||
var documents = []; | ||
for (var uid in uidToDocumentMap) documents.push(uidToDocumentMap[uid]); | ||
var calculateTfIdf = this._createCalculateTfIdf(); | ||
// Return documents sorted by TF-IDF | ||
return documents.sort(function(documentA, documentB) { | ||
return this.calculateTfIdf_(tokens, documentB, corpus) - this.calculateTfIdf_(tokens, documentA, corpus); | ||
}.bind(this)); | ||
}, TfIdfSearchIndex.prototype.calculateIdf_ = function(token, documents) { | ||
if (!this.tokenToIdfCache_[token]) { | ||
var numDocumentsWithToken = this.tokenMap_[token] && this.tokenMap_[token].$numDocumentOccurrences || 0; | ||
this.tokenToIdfCache_[token] = 1 + Math.log(documents.length / (1 + numDocumentsWithToken)); | ||
return calculateTfIdf(tokens, documentB, corpus) - calculateTfIdf(tokens, documentA, corpus); | ||
}); | ||
} | ||
}, { | ||
key: "_createCalculateIdf", | ||
value: function() { | ||
var tokenMap = this._tokenMap, tokenToIdfCache = this._tokenToIdfCache; | ||
return function(token, documents) { | ||
if (!tokenToIdfCache[token]) { | ||
var numDocumentsWithToken = "undefined" != typeof tokenMap[token] ? tokenMap[token].$numDocumentOccurrences : 0; | ||
tokenToIdfCache[token] = 1 + Math.log(documents.length / (1 + numDocumentsWithToken)); | ||
} | ||
return tokenToIdfCache[token]; | ||
}; | ||
} | ||
}, { | ||
key: "_createCalculateTfIdf", | ||
value: function() { | ||
var tokenMap = this._tokenMap, uidFieldName = this._uidFieldName, calculateIdf = this._createCalculateIdf(); | ||
return function(tokens, document, documents) { | ||
for (var score = 0, i = 0, numTokens = tokens.length; i < numTokens; ++i) { | ||
var token = tokens[i], inverseDocumentFrequency = calculateIdf(token, documents); | ||
inverseDocumentFrequency === 1 / 0 && (inverseDocumentFrequency = 0); | ||
var uid; | ||
uid = uidFieldName instanceof Array ? document && (0, _getNestedFieldValue2.default)(document, uidFieldName) : document && document[uidFieldName]; | ||
var termFrequency = "undefined" != typeof tokenMap[token] && "undefined" != typeof tokenMap[token].$uidMap[uid] ? tokenMap[token].$uidMap[uid].$numTokenOccurrences : 0; | ||
score += termFrequency * inverseDocumentFrequency; | ||
} | ||
return score; | ||
}; | ||
} | ||
} ]), TfIdfSearchIndex; | ||
}(); | ||
}, /* 11 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
/** | ||
* Find and return a nested object value. | ||
* | ||
* @param object to crawl | ||
* @param path Property path | ||
* @returns {any} | ||
*/ | ||
function getNestedFieldValue(object, path) { | ||
path = path || [], object = object || {}; | ||
// walk down the property path | ||
for (var value = object, i = 0; i < path.length; i++) if (value = value[path[i]], | ||
null == value) return null; | ||
return value; | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}), exports.default = getNestedFieldValue; | ||
}, /* 12 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { | ||
return typeof obj; | ||
} : function(obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(); | ||
exports.UnorderedSearchIndex = function() { | ||
function UnorderedSearchIndex() { | ||
_classCallCheck(this, UnorderedSearchIndex), this._tokenToUidToDocumentMap = {}; | ||
} | ||
/** | ||
* @inheritDocs | ||
*/ | ||
return _createClass(UnorderedSearchIndex, [ { | ||
key: "indexDocument", | ||
value: function(token, uid, doc) { | ||
"object" !== _typeof(this._tokenToUidToDocumentMap[token]) && (this._tokenToUidToDocumentMap[token] = {}), | ||
this._tokenToUidToDocumentMap[token][uid] = doc; | ||
} | ||
}, { | ||
key: "search", | ||
value: function(tokens, corpus) { | ||
for (var intersectingDocumentMap = {}, tokenToUidToDocumentMap = this._tokenToUidToDocumentMap, i = 0, numTokens = tokens.length; i < numTokens; i++) { | ||
var token = tokens[i], documentMap = tokenToUidToDocumentMap[token]; | ||
// Short circuit if no matches were found for any given token. | ||
if (!documentMap) return []; | ||
if (0 === i) for (var keys = Object.keys(documentMap), j = 0, numKeys = keys.length; j < numKeys; j++) { | ||
var uid = keys[j]; | ||
intersectingDocumentMap[uid] = documentMap[uid]; | ||
} else for (var keys = Object.keys(intersectingDocumentMap), j = 0, numKeys = keys.length; j < numKeys; j++) { | ||
var uid = keys[j]; | ||
"object" !== _typeof(documentMap[uid]) && delete intersectingDocumentMap[uid]; | ||
} | ||
} | ||
return this.tokenToIdfCache_[token]; | ||
}, TfIdfSearchIndex.prototype.calculateTfIdf_ = function(tokens, document, documents) { | ||
for (var score = 0, i = 0, numTokens = tokens.length; i < numTokens; ++i) { | ||
var token = tokens[i], inverseDocumentFrequency = this.calculateIdf_(token, documents); | ||
inverseDocumentFrequency === 1 / 0 && (inverseDocumentFrequency = 0); | ||
var uid = document && document[this.uidFieldName_], termFrequency = this.tokenMap_[token] && this.tokenMap_[token].$uidMap[uid] && this.tokenMap_[token].$uidMap[uid].$numTokenOccurrences || 0; | ||
score += termFrequency * inverseDocumentFrequency; | ||
for (var keys = Object.keys(intersectingDocumentMap), documents = [], i = 0, numKeys = keys.length; i < numKeys; i++) { | ||
var uid = keys[i]; | ||
documents.push(intersectingDocumentMap[uid]); | ||
} | ||
return score; | ||
}, TfIdfSearchIndex; | ||
}(); | ||
JsSearch.TfIdfSearchIndex = TfIdfSearchIndex; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=tf-idf-search-index.js.map | ||
/// <reference path="search-index.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var UnorderedSearchIndex = function() { | ||
function UnorderedSearchIndex() { | ||
this.tokenToUidToDocumentMap_ = {}; | ||
} | ||
return UnorderedSearchIndex.prototype.indexDocument = function(token, uid, document) { | ||
this.tokenToUidToDocumentMap_[token] || (this.tokenToUidToDocumentMap_[token] = {}), | ||
this.tokenToUidToDocumentMap_[token][uid] = document; | ||
}, UnorderedSearchIndex.prototype.search = function(tokens, corpus) { | ||
for (var uidToDocumentMap = {}, i = 0, numTokens = tokens.length; i < numTokens; i++) { | ||
var token = tokens[i], currentUidToDocumentMap = this.tokenToUidToDocumentMap_[token] || {}; | ||
if (0 === i) for (var uid in currentUidToDocumentMap) uidToDocumentMap[uid] = currentUidToDocumentMap[uid]; else for (var uid in uidToDocumentMap) currentUidToDocumentMap[uid] || delete uidToDocumentMap[uid]; | ||
} | ||
var documents = []; | ||
for (var uid in uidToDocumentMap) documents.push(uidToDocumentMap[uid]); | ||
return documents; | ||
}, UnorderedSearchIndex; | ||
}(); | ||
JsSearch.UnorderedSearchIndex = UnorderedSearchIndex; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=unordered-search-index.js.map | ||
/// <reference path="index-strategy/index-strategy.ts" /> | ||
/// <reference path="index-strategy/prefix-index-strategy.ts" /> | ||
/// <reference path="sanitizer/lower-case-sanitizer.ts" /> | ||
/// <reference path="sanitizer/sanitizer.ts" /> | ||
/// <reference path="search-index/search-index.ts" /> | ||
/// <reference path="search-index/tf-idf-search-index.ts" /> | ||
/// <reference path="tokenizer/simple-tokenizer.ts" /> | ||
/// <reference path="tokenizer/tokenizer.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var Search = function() { | ||
function Search(uidFieldName) { | ||
this.uidFieldName_ = uidFieldName, this.indexStrategy_ = new JsSearch.PrefixIndexStrategy(), | ||
this.searchIndex_ = new JsSearch.TfIdfSearchIndex(uidFieldName), this.sanitizer_ = new JsSearch.LowerCaseSanitizer(), | ||
this.tokenizer_ = new JsSearch.SimpleTokenizer(), this.documents_ = [], this.searchableFields = []; | ||
} | ||
return Object.defineProperty(Search.prototype, "indexStrategy", { | ||
get: function() { | ||
return this.indexStrategy_; | ||
}, | ||
set: function(value) { | ||
if (this.initialized_) throw Error("IIndexStrategy cannot be set after initialization"); | ||
this.indexStrategy_ = value; | ||
}, | ||
enumerable: !0, | ||
configurable: !0 | ||
}), Object.defineProperty(Search.prototype, "sanitizer", { | ||
get: function() { | ||
return this.sanitizer_; | ||
}, | ||
set: function(value) { | ||
if (this.initialized_) throw Error("ISanitizer cannot be set after initialization"); | ||
this.sanitizer_ = value; | ||
}, | ||
enumerable: !0, | ||
configurable: !0 | ||
}), Object.defineProperty(Search.prototype, "searchIndex", { | ||
get: function() { | ||
return this.searchIndex_; | ||
}, | ||
set: function(value) { | ||
if (this.initialized_) throw Error("ISearchIndex cannot be set after initialization"); | ||
this.searchIndex_ = value; | ||
}, | ||
enumerable: !0, | ||
configurable: !0 | ||
}), Object.defineProperty(Search.prototype, "tokenizer", { | ||
get: function() { | ||
return this.tokenizer_; | ||
}, | ||
set: function(value) { | ||
if (this.initialized_) throw Error("ITokenizer cannot be set after initialization"); | ||
this.tokenizer_ = value; | ||
}, | ||
enumerable: !0, | ||
configurable: !0 | ||
}), Search.prototype.addDocument = function(document) { | ||
} ]), UnorderedSearchIndex; | ||
}(); | ||
}, /* 13 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _SimpleTokenizer = __webpack_require__(14); | ||
Object.defineProperty(exports, "SimpleTokenizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _SimpleTokenizer.SimpleTokenizer; | ||
} | ||
}); | ||
var _StemmingTokenizer = __webpack_require__(15); | ||
Object.defineProperty(exports, "StemmingTokenizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _StemmingTokenizer.StemmingTokenizer; | ||
} | ||
}); | ||
var _StopWordsTokenizer = __webpack_require__(16); | ||
Object.defineProperty(exports, "StopWordsTokenizer", { | ||
enumerable: !0, | ||
get: function() { | ||
return _StopWordsTokenizer.StopWordsTokenizer; | ||
} | ||
}); | ||
}, /* 14 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(), REGEX = /[^a-zа-яё0-9\-']+/i; | ||
exports.SimpleTokenizer = function() { | ||
function SimpleTokenizer() { | ||
_classCallCheck(this, SimpleTokenizer); | ||
} | ||
return _createClass(SimpleTokenizer, [ { | ||
key: "tokenize", | ||
/** | ||
* @inheritDocs | ||
*/ | ||
value: function(text) { | ||
return text.split(REGEX).filter(function(text) { | ||
return text; | ||
}); | ||
} | ||
} ]), SimpleTokenizer; | ||
}(); | ||
}, /* 15 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(); | ||
exports.StemmingTokenizer = function() { | ||
/** | ||
* Constructor. | ||
* | ||
* @param stemmingFunction Function capable of accepting a word and returning its stem. | ||
* @param decoratedIndexStrategy Index strategy to be run after all stop words have been removed. | ||
*/ | ||
function StemmingTokenizer(stemmingFunction, decoratedTokenizer) { | ||
_classCallCheck(this, StemmingTokenizer), this._stemmingFunction = stemmingFunction, | ||
this._tokenizer = decoratedTokenizer; | ||
} | ||
/** | ||
* @inheritDocs | ||
*/ | ||
return _createClass(StemmingTokenizer, [ { | ||
key: "tokenize", | ||
value: function(text) { | ||
return this._tokenizer.tokenize(text).map(this._stemmingFunction); | ||
} | ||
} ]), StemmingTokenizer; | ||
}(); | ||
}, /* 16 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}), exports.StopWordsTokenizer = void 0; | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(), _StopWordsMap = __webpack_require__(17); | ||
exports.StopWordsTokenizer = function() { | ||
/** | ||
* Constructor. | ||
* | ||
* @param decoratedIndexStrategy Index strategy to be run after all stop words have been removed. | ||
*/ | ||
function StopWordsTokenizer(decoratedTokenizer) { | ||
_classCallCheck(this, StopWordsTokenizer), this._tokenizer = decoratedTokenizer; | ||
} | ||
/** | ||
* @inheritDocs | ||
*/ | ||
return _createClass(StopWordsTokenizer, [ { | ||
key: "tokenize", | ||
value: function(text) { | ||
return this._tokenizer.tokenize(text).filter(function(token) { | ||
return !_StopWordsMap.StopWordsMap[token]; | ||
}); | ||
} | ||
} ]), StopWordsTokenizer; | ||
}(); | ||
}, /* 17 */ | ||
/***/ | ||
function(module, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var StopWordsMap = exports.StopWordsMap = { | ||
a: !0, | ||
able: !0, | ||
about: !0, | ||
across: !0, | ||
after: !0, | ||
all: !0, | ||
almost: !0, | ||
also: !0, | ||
am: !0, | ||
among: !0, | ||
an: !0, | ||
and: !0, | ||
any: !0, | ||
are: !0, | ||
as: !0, | ||
at: !0, | ||
be: !0, | ||
because: !0, | ||
been: !0, | ||
but: !0, | ||
by: !0, | ||
can: !0, | ||
cannot: !0, | ||
could: !0, | ||
dear: !0, | ||
did: !0, | ||
do: !0, | ||
does: !0, | ||
either: !0, | ||
else: !0, | ||
ever: !0, | ||
every: !0, | ||
for: !0, | ||
from: !0, | ||
get: !0, | ||
got: !0, | ||
had: !0, | ||
has: !0, | ||
have: !0, | ||
he: !0, | ||
her: !0, | ||
hers: !0, | ||
him: !0, | ||
his: !0, | ||
how: !0, | ||
however: !0, | ||
i: !0, | ||
if: !0, | ||
in: !0, | ||
into: !0, | ||
is: !0, | ||
it: !0, | ||
its: !0, | ||
just: !0, | ||
least: !0, | ||
let: !0, | ||
like: !0, | ||
likely: !0, | ||
may: !0, | ||
me: !0, | ||
might: !0, | ||
most: !0, | ||
must: !0, | ||
my: !0, | ||
neither: !0, | ||
no: !0, | ||
nor: !0, | ||
not: !0, | ||
of: !0, | ||
off: !0, | ||
often: !0, | ||
on: !0, | ||
only: !0, | ||
or: !0, | ||
other: !0, | ||
our: !0, | ||
own: !0, | ||
rather: !0, | ||
said: !0, | ||
say: !0, | ||
says: !0, | ||
she: !0, | ||
should: !0, | ||
since: !0, | ||
so: !0, | ||
some: !0, | ||
than: !0, | ||
that: !0, | ||
the: !0, | ||
their: !0, | ||
them: !0, | ||
then: !0, | ||
there: !0, | ||
these: !0, | ||
they: !0, | ||
this: !0, | ||
tis: !0, | ||
to: !0, | ||
too: !0, | ||
twas: !0, | ||
us: !0, | ||
wants: !0, | ||
was: !0, | ||
we: !0, | ||
were: !0, | ||
what: !0, | ||
when: !0, | ||
where: !0, | ||
which: !0, | ||
while: !0, | ||
who: !0, | ||
whom: !0, | ||
why: !0, | ||
will: !0, | ||
with: !0, | ||
would: !0, | ||
yet: !0, | ||
you: !0, | ||
your: !0 | ||
}; | ||
// Prevent false positives for inherited properties | ||
StopWordsMap.constructor = !1, StopWordsMap.hasOwnProperty = !1, StopWordsMap.isPrototypeOf = !1, | ||
StopWordsMap.propertyIsEnumerable = !1, StopWordsMap.toLocaleString = !1, StopWordsMap.toString = !1, | ||
StopWordsMap.valueOf = !1; | ||
}, /* 18 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}), exports.Search = void 0; | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(), _getNestedFieldValue = __webpack_require__(11), _getNestedFieldValue2 = _interopRequireDefault(_getNestedFieldValue), _index = __webpack_require__(2), _index2 = __webpack_require__(6), _index3 = __webpack_require__(9), _index4 = __webpack_require__(13); | ||
exports.Search = function() { | ||
/** | ||
* Constructor. | ||
* @param uidFieldName Field containing values that uniquely identify search documents; this field's values are used | ||
* to ensure that a search result set does not contain duplicate objects. | ||
*/ | ||
/** | ||
* Array containing either a property name or a path (list of property names) to a nested value | ||
*/ | ||
function Search(uidFieldName) { | ||
if (_classCallCheck(this, Search), !uidFieldName) throw Error("js-search requires a uid field name constructor parameter"); | ||
this._uidFieldName = uidFieldName, // Set default/recommended strategies | ||
this._indexStrategy = new _index.PrefixIndexStrategy(), this._searchIndex = new _index3.TfIdfSearchIndex(uidFieldName), | ||
this._sanitizer = new _index2.LowerCaseSanitizer(), this._tokenizer = new _index4.SimpleTokenizer(), | ||
this._documents = [], this._searchableFields = []; | ||
} | ||
/** | ||
* Override the default index strategy. | ||
* @param value Custom index strategy | ||
* @throws Error if documents have already been indexed by this search instance | ||
*/ | ||
return _createClass(Search, [ { | ||
key: "addDocument", | ||
/** | ||
* Add a searchable document to the index. Document will automatically be indexed for search. | ||
* @param document | ||
*/ | ||
value: function(document) { | ||
this.addDocuments([ document ]); | ||
}, Search.prototype.addDocuments = function(documents) { | ||
this.documents_ = this.documents_.concat(documents), this.indexDocuments_(documents, this.searchableFields); | ||
}, Search.prototype.addIndex = function(field) { | ||
this.searchableFields.push(field), this.indexDocuments_(this.documents_, [ field ]); | ||
}, Search.prototype.search = function(query) { | ||
var tokens = this.tokenizer_.tokenize(this.sanitizer_.sanitize(query)); | ||
return this.searchIndex_.search(tokens, this.documents_); | ||
}, Search.prototype.indexDocuments_ = function(documents, searchableFields) { | ||
this.initialized_ = !0; | ||
for (var di = 0, numDocuments = documents.length; di < numDocuments; di++) for (var document = documents[di], uid = document[this.uidFieldName_], sfi = 0, numSearchableFields = searchableFields.length; sfi < numSearchableFields; sfi++) { | ||
var fieldValue, searchableField = searchableFields[sfi]; | ||
if (fieldValue = searchableField instanceof Array ? Search.getNestedFieldValue(document, searchableField) : document[searchableField], | ||
null != fieldValue && "string" != typeof fieldValue && fieldValue.toString && (fieldValue = fieldValue.toString()), | ||
"string" == typeof fieldValue) for (var fieldTokens = this.tokenizer_.tokenize(this.sanitizer_.sanitize(fieldValue)), fti = 0, numFieldValues = fieldTokens.length; fti < numFieldValues; fti++) for (var fieldToken = fieldTokens[fti], expandedTokens = this.indexStrategy_.expandToken(fieldToken), eti = 0, nummExpandedTokens = expandedTokens.length; eti < nummExpandedTokens; eti++) { | ||
var expandedToken = expandedTokens[eti]; | ||
this.searchIndex_.indexDocument(expandedToken, uid, document); | ||
} | ||
}, { | ||
key: "addDocuments", | ||
value: function(documents) { | ||
this._documents = this._documents.concat(documents), this.indexDocuments_(documents, this._searchableFields); | ||
} | ||
}, { | ||
key: "addIndex", | ||
value: function(field) { | ||
this._searchableFields.push(field), this.indexDocuments_(this._documents, [ field ]); | ||
} | ||
}, { | ||
key: "search", | ||
value: function(query) { | ||
var tokens = this._tokenizer.tokenize(this._sanitizer.sanitize(query)); | ||
return this._searchIndex.search(tokens, this._documents); | ||
} | ||
}, { | ||
key: "indexDocuments_", | ||
value: function(documents, _searchableFields) { | ||
this._initialized = !0; | ||
for (var indexStrategy = this._indexStrategy, sanitizer = this._sanitizer, searchIndex = this._searchIndex, tokenizer = this._tokenizer, uidFieldName = this._uidFieldName, di = 0, numDocuments = documents.length; di < numDocuments; di++) { | ||
var uid, doc = documents[di]; | ||
uid = uidFieldName instanceof Array ? (0, _getNestedFieldValue2.default)(doc, uidFieldName) : doc[uidFieldName]; | ||
for (var sfi = 0, numSearchableFields = _searchableFields.length; sfi < numSearchableFields; sfi++) { | ||
var fieldValue, searchableField = _searchableFields[sfi]; | ||
if (fieldValue = searchableField instanceof Array ? (0, _getNestedFieldValue2.default)(doc, searchableField) : doc[searchableField], | ||
null != fieldValue && "string" != typeof fieldValue && fieldValue.toString && (fieldValue = fieldValue.toString()), | ||
"string" == typeof fieldValue) for (var fieldTokens = tokenizer.tokenize(sanitizer.sanitize(fieldValue)), fti = 0, numFieldValues = fieldTokens.length; fti < numFieldValues; fti++) for (var fieldToken = fieldTokens[fti], expandedTokens = indexStrategy.expandToken(fieldToken), eti = 0, nummExpandedTokens = expandedTokens.length; eti < nummExpandedTokens; eti++) { | ||
var expandedToken = expandedTokens[eti]; | ||
searchIndex.indexDocument(expandedToken, uid, doc); | ||
} | ||
} | ||
} | ||
}, Search.getNestedFieldValue = function(object, path) { | ||
path = path || [], object = object || {}; | ||
for (var value = object, i = 0; i < path.length; i++) if (value = value[path[i]], | ||
null == value) return null; | ||
return value; | ||
}, Search; | ||
}(); | ||
JsSearch.Search = Search; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=search.js.map | ||
var JsSearch; | ||
!function(JsSearch) { | ||
JsSearch.StopWordsMap = { | ||
a: "a", | ||
able: "able", | ||
about: "about", | ||
across: "across", | ||
after: "after", | ||
all: "all", | ||
almost: "almost", | ||
also: "also", | ||
am: "am", | ||
among: "among", | ||
an: "an", | ||
and: "and", | ||
any: "any", | ||
are: "are", | ||
as: "as", | ||
at: "at", | ||
be: "be", | ||
because: "because", | ||
been: "been", | ||
but: "but", | ||
by: "by", | ||
can: "can", | ||
cannot: "cannot", | ||
could: "could", | ||
dear: "dear", | ||
did: "did", | ||
do: "do", | ||
does: "does", | ||
either: "either", | ||
else: "else", | ||
ever: "ever", | ||
every: "every", | ||
for: "for", | ||
from: "from", | ||
get: "get", | ||
got: "got", | ||
had: "had", | ||
has: "has", | ||
have: "have", | ||
he: "he", | ||
her: "her", | ||
hers: "hers", | ||
him: "him", | ||
his: "his", | ||
how: "how", | ||
however: "however", | ||
i: "i", | ||
if: "if", | ||
in: "in", | ||
into: "into", | ||
is: "is", | ||
it: "it", | ||
its: "its", | ||
just: "just", | ||
least: "least", | ||
let: "let", | ||
like: "like", | ||
likely: "likely", | ||
may: "may", | ||
me: "me", | ||
might: "might", | ||
most: "most", | ||
must: "must", | ||
my: "my", | ||
neither: "neither", | ||
no: "no", | ||
nor: "nor", | ||
not: "not", | ||
of: "of", | ||
off: "off", | ||
often: "often", | ||
on: "on", | ||
only: "only", | ||
or: "or", | ||
other: "other", | ||
our: "our", | ||
own: "own", | ||
rather: "rather", | ||
said: "said", | ||
say: "say", | ||
says: "says", | ||
she: "she", | ||
should: "should", | ||
since: "since", | ||
so: "so", | ||
some: "some", | ||
than: "than", | ||
that: "that", | ||
the: "the", | ||
their: "their", | ||
them: "them", | ||
then: "then", | ||
there: "there", | ||
these: "these", | ||
they: "they", | ||
this: "this", | ||
tis: "tis", | ||
to: "to", | ||
too: "too", | ||
twas: "twas", | ||
us: "us", | ||
wants: "wants", | ||
was: "was", | ||
we: "we", | ||
were: "were", | ||
what: "what", | ||
when: "when", | ||
where: "where", | ||
which: "which", | ||
while: "while", | ||
who: "who", | ||
whom: "whom", | ||
why: "why", | ||
will: "will", | ||
with: "with", | ||
would: "would", | ||
yet: "yet", | ||
you: "you", | ||
your: "your" | ||
} | ||
}, { | ||
key: "indexStrategy", | ||
set: function(value) { | ||
if (this._initialized) throw Error("IIndexStrategy cannot be set after initialization"); | ||
this._indexStrategy = value; | ||
}, | ||
get: function() { | ||
return this._indexStrategy; | ||
} | ||
}, { | ||
key: "sanitizer", | ||
set: function(value) { | ||
if (this._initialized) throw Error("ISanitizer cannot be set after initialization"); | ||
this._sanitizer = value; | ||
}, | ||
get: function() { | ||
return this._sanitizer; | ||
} | ||
}, { | ||
key: "searchIndex", | ||
set: function(value) { | ||
if (this._initialized) throw Error("ISearchIndex cannot be set after initialization"); | ||
this._searchIndex = value; | ||
}, | ||
get: function() { | ||
return this._searchIndex; | ||
} | ||
}, { | ||
key: "tokenizer", | ||
set: function(value) { | ||
if (this._initialized) throw Error("ITokenizer cannot be set after initialization"); | ||
this._tokenizer = value; | ||
}, | ||
get: function() { | ||
return this._tokenizer; | ||
} | ||
} ]), Search; | ||
}(); | ||
}, /* 19 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}), exports.TokenHighlighter = void 0; | ||
var _createClass = function() { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, | ||
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function(Constructor, protoProps, staticProps) { | ||
return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), | ||
Constructor; | ||
}; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=stop-words-map.js.map | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var TokenHighlighter = function() { | ||
function TokenHighlighter(opt_indexStrategy, opt_sanitizer, opt_wrapperTagName) { | ||
this.indexStrategy_ = opt_indexStrategy || new JsSearch.PrefixIndexStrategy(), this.sanitizer_ = opt_sanitizer || new JsSearch.LowerCaseSanitizer(), | ||
this.wrapperTagName_ = opt_wrapperTagName || "mark"; | ||
} | ||
return TokenHighlighter.prototype.highlight = function(text, tokens) { | ||
for (var tagsLength = this.wrapText_("").length, tokenDictionary = {}, i = 0, numTokens = tokens.length; i < numTokens; i++) for (var token = this.sanitizer_.sanitize(tokens[i]), expandedTokens = this.indexStrategy_.expandToken(token), j = 0, numExpandedTokens = expandedTokens.length; j < numExpandedTokens; j++) { | ||
}(), _index = __webpack_require__(2), _index2 = __webpack_require__(6); | ||
exports.TokenHighlighter = function() { | ||
/** | ||
* Constructor. | ||
* | ||
* @param opt_indexStrategy Index strategy used by Search | ||
* @param opt_sanitizer Sanitizer used by Search | ||
* @param opt_wrapperTagName Optional wrapper tag name; defaults to 'mark' (e.g. <mark>) | ||
*/ | ||
function TokenHighlighter(opt_indexStrategy, opt_sanitizer, opt_wrapperTagName) { | ||
_classCallCheck(this, TokenHighlighter), this._indexStrategy = opt_indexStrategy || new _index.PrefixIndexStrategy(), | ||
this._sanitizer = opt_sanitizer || new _index2.LowerCaseSanitizer(), this._wrapperTagName = opt_wrapperTagName || "mark"; | ||
} | ||
/** | ||
* Highlights token occurrences within a string by wrapping them with a DOM element. | ||
* | ||
* @param text e.g. "john wayne" | ||
* @param tokens e.g. ["wa"] | ||
* @returns {string} e.g. "john <mark>wa</mark>yne" | ||
*/ | ||
return _createClass(TokenHighlighter, [ { | ||
key: "highlight", | ||
value: function(text, tokens) { | ||
// Create a token map for easier lookup below. | ||
for (var tagsLength = this._wrapText("").length, tokenDictionary = {}, i = 0, numTokens = tokens.length; i < numTokens; i++) for (var token = this._sanitizer.sanitize(tokens[i]), expandedTokens = this._indexStrategy.expandToken(token), j = 0, numExpandedTokens = expandedTokens.length; j < numExpandedTokens; j++) { | ||
var expandedToken = expandedTokens[j]; | ||
tokenDictionary[expandedToken] ? tokenDictionary[expandedToken].push(token) : tokenDictionary[expandedToken] = [ token ]; | ||
} | ||
// Note this assumes either prefix or full word matching. | ||
for (var actualCurrentWord = "", sanitizedCurrentWord = "", currentWordStartIndex = 0, i = 0, textLength = text.length; i < textLength; i++) { | ||
var character = text.charAt(i); | ||
" " === character ? (actualCurrentWord = "", sanitizedCurrentWord = "", currentWordStartIndex = i + 1) : (actualCurrentWord += character, | ||
sanitizedCurrentWord += this.sanitizer_.sanitize(character)), tokenDictionary[sanitizedCurrentWord] && tokenDictionary[sanitizedCurrentWord].indexOf(sanitizedCurrentWord) >= 0 && (actualCurrentWord = this.wrapText_(actualCurrentWord), | ||
sanitizedCurrentWord += this._sanitizer.sanitize(character)), tokenDictionary[sanitizedCurrentWord] && tokenDictionary[sanitizedCurrentWord].indexOf(sanitizedCurrentWord) >= 0 && (actualCurrentWord = this._wrapText(actualCurrentWord), | ||
text = text.substring(0, currentWordStartIndex) + actualCurrentWord + text.substring(i + 1), | ||
@@ -484,62 +1115,13 @@ i += tagsLength, textLength += tagsLength); | ||
return text; | ||
}, TokenHighlighter.prototype.wrapText_ = function(text) { | ||
return "<" + this.wrapperTagName_ + ">" + text + "</" + this.wrapperTagName_ + ">"; | ||
}, TokenHighlighter; | ||
}(); | ||
JsSearch.TokenHighlighter = TokenHighlighter; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=token-highlighter.js.map | ||
/// <reference path="tokenizer.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var SimpleTokenizer = function() { | ||
function SimpleTokenizer() {} | ||
return SimpleTokenizer.prototype.tokenize = function(text) { | ||
return text.split(/[^a-zA-Z0-9\-']+/).filter(function(text) { | ||
return !!text; | ||
}); | ||
}, SimpleTokenizer; | ||
}(); | ||
JsSearch.SimpleTokenizer = SimpleTokenizer; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=simple-tokenizer.js.map | ||
/// <reference path="tokenizer.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var StemmingTokenizer = function() { | ||
function StemmingTokenizer(stemmingFunction, decoratedTokenizer) { | ||
this.stemmingFunction_ = stemmingFunction, this.tokenizer_ = decoratedTokenizer; | ||
} | ||
return StemmingTokenizer.prototype.tokenize = function(text) { | ||
return this.tokenizer_.tokenize(text).map(function(token) { | ||
return this.stemmingFunction_(token); | ||
}, this); | ||
}, StemmingTokenizer; | ||
}(); | ||
JsSearch.StemmingTokenizer = StemmingTokenizer; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=stemming-tokenizer.js.map | ||
/// <reference path="tokenizer.ts" /> | ||
var JsSearch; | ||
!function(JsSearch) { | ||
var StopWordsTokenizer = function() { | ||
function StopWordsTokenizer(decoratedTokenizer) { | ||
this.tokenizer_ = decoratedTokenizer; | ||
}, { | ||
key: "_wrapText", | ||
value: function(text) { | ||
var tagName = this._wrapperTagName; | ||
return "<" + tagName + ">" + text + "</" + tagName + ">"; | ||
} | ||
return StopWordsTokenizer.prototype.tokenize = function(text) { | ||
return this.tokenizer_.tokenize(text).filter(function(token) { | ||
return token && JsSearch.StopWordsMap[token] !== token; | ||
}); | ||
}, StopWordsTokenizer; | ||
}(); | ||
JsSearch.StopWordsTokenizer = StopWordsTokenizer; | ||
}(JsSearch || (JsSearch = {})); | ||
//# sourceMappingURL=stop-words-filtering-tokenizer.js.map | ||
var JsSearch; | ||
!function(JsSearch) {}(JsSearch || (JsSearch = {})), //# sourceMappingURL=tokenizer.js.map | ||
function(JsSearch) { | ||
"undefined" != typeof module && module.exports && JsSearch && (module.exports = JsSearch); | ||
}(JsSearch || (JsSearch = {})); | ||
} ]), TokenHighlighter; | ||
}(); | ||
} ]); | ||
}); | ||
//# sourceMappingURL=react-select-fast-filter-options.js.map |
{ | ||
"name": "react-select-fast-filter-options", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "react-select filterOptions function optimized to quickly filter large options lists", | ||
@@ -19,4 +19,4 @@ "main": "dist/commonjs/index.js", | ||
"deploy": "gh-pages -d build", | ||
"postbuild": "cp ./styles.css ./build/", | ||
"postpublish": "npm run deploy", | ||
"predeploy": "cp ./styles.css ./build/", | ||
"start": "cross-env NODE_ENV=development webpack-dev-server --hot --inline --config webpack.config.dev.js" | ||
@@ -58,13 +58,15 @@ }, | ||
"babel-eslint": "^6.0.4", | ||
"babel-jest": "^18.0.0", | ||
"babel-loader": "^6.2.3", | ||
"babel-plugin-__coverage__": "^0.111111.11", | ||
"babel-plugin-react-transform": "^2.0.0", | ||
"babel-plugin-transform-decorators-legacy": "^1.3.4", | ||
"babel-plugin-transform-react-inline-elements": "^6.6.5", | ||
"babel-plugin-transform-runtime": "^6.15.0", | ||
"babel-plugin-typecheck": "^3.9.0", | ||
"babel-polyfill": "^6.5.0", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-preset-es2015-rollup": "^1.1.1", | ||
"babel-preset-es2015": "6.22.0", | ||
"babel-preset-es2015-rollup": "3.0.0", | ||
"babel-preset-react": "^6.5.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-preset-stage-2": "^6.5.0", | ||
"css-loader": "^0.25.0", | ||
"cross-env": "^3.1.3", | ||
@@ -83,2 +85,3 @@ "extract-text-webpack-plugin": "^1.0.1", | ||
"redbox-react": "^1.3.0", | ||
"rimraf": "^2.5.4", | ||
"standard": "^7.0.1", | ||
@@ -85,0 +88,0 @@ "style-loader": "^0.13.0", |
@@ -5,6 +5,4 @@ # react-select-fast-filter-options | ||
## Getting started | ||
## Installation | ||
#### Installation | ||
The easiest way to install is using NPM: | ||
@@ -23,2 +21,6 @@ | ||
## Examples | ||
#### Basic example | ||
Here's how to fast filter with [`react-select`](https://github.com/JedWatson/react-select) or [`react-virtualized-select`](https://github.com/bvaughn/react-virtualized-select): | ||
@@ -30,10 +32,43 @@ | ||
// Import the fast-filter library | ||
import createFilterOptions from 'react-select-fast-filter-options' | ||
// The search index will need to be recreated if your options array changes. | ||
// This index is powered by js-search: https://github.com/bvaughn/js-search | ||
const filterOptions = createFilterOptions({ options }) | ||
// Render your Select, complete with the fast-filter index | ||
function render ({ options }) { | ||
return ( | ||
<Select | ||
filterOptions={filterOptions} | ||
options={options} | ||
{...otherSelectProps} | ||
/> | ||
) | ||
} | ||
``` | ||
Here's how to fast filter with [`redux`](https://github.com/reactjs/redux), [`react-redux`](https://github.com/reactjs/react-redux), and [`reselect`](https://github.com/reactjs/reselect) | ||
#### Redux example | ||
##### selectors/SearchSelectors.js | ||
```js | ||
// selectors file | ||
import { createSelector } from 'reselect'; | ||
import createFilterOptions from 'react-select-fast-filter-options'; | ||
// Create a search index optimized to quickly filter options. | ||
// The search index will need to be recreated if your options array changes. | ||
// This index is powered by js-search: https://github.com/bvaughn/js-search | ||
const filterOptions = createFilterOptions({ options }) | ||
// Reselect will only re-run this if options has changed | ||
export const getIndexedOptions = createSelector( | ||
state => state.options, | ||
options => createFilterOptions({ options }) | ||
) | ||
``` | ||
##### components/Search.js | ||
```js | ||
// Import the Select component from either react-select or react-virtualized-select | ||
import Select from 'react-virtualized-select'; // or from 'react-select' | ||
// Render your Select, complete with the fast-filter index | ||
@@ -49,2 +84,13 @@ function render ({ options }) { | ||
} | ||
import { connect } from 'react-redux'; | ||
import { getIndexedOptions } from 'selectors/SearchSelectors' | ||
const mapStateToProps = (state) => ({ | ||
options: getIndexedOptions(state) | ||
}) | ||
export default connect(mapStateToProps)( | ||
render | ||
) | ||
``` | ||
@@ -61,8 +107,8 @@ | ||
| `indexes` | `Array<String>` | | Optional array of attributes to build search index from; defaults to the `labelKey` attribute. | | ||
| `indexStrategy` | [`IIndexStrategy`](https://github.com/bvaughn/js-search/blob/master/source/index-strategy/index-strategy.ts) | [`AllSubstringsIndexStrategy`](https://github.com/bvaughn/js-search/blob/master/source/index-strategy/all-substrings-index-strategy.ts) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `indexStrategy` | [`IndexStrategy`](https://github.com/bvaughn/js-search/blob/master/source/IndexStrategy/IndexStrategy.js) | [`AllSubstringsIndexStrategy`](https://github.com/bvaughn/js-search/blob/master/source/IndexStrategy/AllSubstringsIndexStrategy.js) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `labelKey` | string | "label" | Option key containing the display text | | ||
| `options` | array | [] | Array of options objects | | ||
| `sanitizer` | [`ISanitizer`](https://github.com/bvaughn/js-search/blob/master/source/sanitizer/sanitizer.ts) | [`LowerCaseSanitizer`](https://github.com/bvaughn/js-search/blob/master/source/sanitizer/lower-case-sanitizer.ts) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `searchIndex` | [`ISearchIndex`](https://github.com/bvaughn/js-search/blob/master/source/search-index/search-index.ts) | [`UnorderedSearchIndex`](https://github.com/bvaughn/js-search/blob/master/source/search-index/unordered-search-index.ts) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `tokenizer` | [`ITokenizer`](https://github.com/bvaughn/js-search/blob/master/source/tokenizer/tokenizer.ts) | [`SimpleTokenizer`](https://github.com/bvaughn/js-search/blob/master/source/tokenizer/simple-tokenizer.ts) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `sanitizer` | [`Sanitizer`](https://github.com/bvaughn/js-search/blob/master/source/Sanitizer/Sanitizer.js) | [`LowerCaseSanitizer`](https://github.com/bvaughn/js-search/blob/master/source/Sanitizer/LowerCaseSanitizer.js) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `searchIndex` | [`SearchIndex`](https://github.com/bvaughn/js-search/blob/master/source/SearchIndex/SearchIndex.js) | [`UnorderedSearchIndex`](https://github.com/bvaughn/js-search/blob/master/source/SearchIndex/UnorderedSearchIndex.js) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `tokenizer` | [`Tokenizer`](https://github.com/bvaughn/js-search/blob/master/source/Tokenizer/Tokenizer.js) | [`SimpleTokenizer`](https://github.com/bvaughn/js-search/blob/master/source/Tokenizer/SimpleTokenizer.js) | See [js-search docs](https://github.com/bvaughn/js-search) | | ||
| `valueKey` | string | "value" | Option key containing the value | | ||
@@ -69,0 +115,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
364469
9
1285
164
35