react-select-fast-filter-options
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -0,1 +1,4 @@ | ||
##### 0.0.3 | ||
Fixed invalid `package.json` "main" entry. | ||
##### 0.0.2 | ||
@@ -2,0 +5,0 @@ Initial release. |
@@ -11,2 +11,3 @@ 'use strict'; | ||
function createFilterOptions(_ref) { | ||
var indexStrategy = _ref.indexStrategy; | ||
var _ref$labelKey = _ref.labelKey; | ||
@@ -16,2 +17,5 @@ var labelKey = _ref$labelKey === undefined ? 'label' : _ref$labelKey; | ||
var options = _ref$options === undefined ? [] : _ref$options; | ||
var sanitizer = _ref.sanitizer; | ||
var searchIndex = _ref.searchIndex; | ||
var tokenizer = _ref.tokenizer; | ||
var _ref$valueKey = _ref.valueKey; | ||
@@ -21,3 +25,14 @@ var valueKey = _ref$valueKey === undefined ? 'value' : _ref$valueKey; | ||
var search = new _jsSearch.Search(valueKey); | ||
search.searchIndex = new _jsSearch.UnorderedSearchIndex(); | ||
search.searchIndex = searchIndex || new _jsSearch.UnorderedSearchIndex(); | ||
if (indexStrategy) { | ||
search.indexStrategy = indexStrategy; | ||
} | ||
if (sanitizer) { | ||
search.sanitizer = sanitizer; | ||
} | ||
if (tokenizer) { | ||
search.tokenizer = tokenizer; | ||
} | ||
search.addIndex(labelKey); | ||
@@ -24,0 +39,0 @@ search.addDocuments(options); |
import { Search, UnorderedSearchIndex } from 'js-search'; | ||
export default function createFilterOptions(_ref) { | ||
var indexStrategy = _ref.indexStrategy; | ||
var _ref$labelKey = _ref.labelKey; | ||
@@ -8,2 +9,5 @@ var labelKey = _ref$labelKey === undefined ? 'label' : _ref$labelKey; | ||
var options = _ref$options === undefined ? [] : _ref$options; | ||
var sanitizer = _ref.sanitizer; | ||
var searchIndex = _ref.searchIndex; | ||
var tokenizer = _ref.tokenizer; | ||
var _ref$valueKey = _ref.valueKey; | ||
@@ -13,3 +17,14 @@ var valueKey = _ref$valueKey === undefined ? 'value' : _ref$valueKey; | ||
var search = new Search(valueKey); | ||
search.searchIndex = new UnorderedSearchIndex(); | ||
search.searchIndex = searchIndex || new UnorderedSearchIndex(); | ||
if (indexStrategy) { | ||
search.indexStrategy = indexStrategy; | ||
} | ||
if (sanitizer) { | ||
search.sanitizer = sanitizer; | ||
} | ||
if (tokenizer) { | ||
search.tokenizer = tokenizer; | ||
} | ||
search.addIndex(labelKey); | ||
@@ -16,0 +31,0 @@ search.addDocuments(options); |
@@ -73,5 +73,7 @@ !function(root, factory) { | ||
function createFilterOptions(_ref) { | ||
var _ref$labelKey = _ref.labelKey, labelKey = void 0 === _ref$labelKey ? "label" : _ref$labelKey, _ref$options = _ref.options, options = void 0 === _ref$options ? [] : _ref$options, _ref$valueKey = _ref.valueKey, valueKey = void 0 === _ref$valueKey ? "value" : _ref$valueKey, search = new _jsSearch.Search(valueKey); | ||
return search.searchIndex = new _jsSearch.UnorderedSearchIndex(), search.addIndex(labelKey), | ||
search.addDocuments(options), function(options, filter) { | ||
var indexStrategy = _ref.indexStrategy, _ref$labelKey = _ref.labelKey, labelKey = void 0 === _ref$labelKey ? "label" : _ref$labelKey, _ref$options = _ref.options, options = void 0 === _ref$options ? [] : _ref$options, sanitizer = _ref.sanitizer, searchIndex = _ref.searchIndex, tokenizer = _ref.tokenizer, _ref$valueKey = _ref.valueKey, valueKey = void 0 === _ref$valueKey ? "value" : _ref$valueKey, search = new _jsSearch.Search(valueKey); | ||
return search.searchIndex = searchIndex || new _jsSearch.UnorderedSearchIndex(), | ||
indexStrategy && (search.indexStrategy = indexStrategy), sanitizer && (search.sanitizer = sanitizer), | ||
tokenizer && (search.tokenizer = tokenizer), search.addIndex(labelKey), search.addDocuments(options), | ||
function(options, filter) { | ||
return filter ? search.search(filter) : options; | ||
@@ -289,3 +291,3 @@ }; | ||
}, Search.prototype.addDocuments = function(documents) { | ||
this.documents_.push.apply(this.documents_, documents), this.indexDocuments_(documents, this.searchableFields); | ||
this.documents_ = this.documents_.concat(documents), this.indexDocuments_(documents, this.searchableFields); | ||
}, Search.prototype.addIndex = function(field) { | ||
@@ -292,0 +294,0 @@ this.searchableFields.push(field), this.indexDocuments_(this.documents_, [ field ]); |
{ | ||
"name": "react-select-fast-filter-options", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "react-select filterOptions function optimized to quickly filter large options lists", | ||
"main": "index.js", | ||
"main": "dist/commonjs/index.js", | ||
"jsnext:main": "dist/es/index.js", | ||
"scripts": { | ||
@@ -17,2 +18,5 @@ "build": "npm run build:commonjs && npm run build:es && npm run build:demo && npm run build:umd", | ||
"clean:umd": "rimraf dist/umd", | ||
"deploy": "gh-pages -d 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" | ||
@@ -67,2 +71,3 @@ }, | ||
"file-loader": "^0.9.0", | ||
"gh-pages": "^0.11.0", | ||
"html-webpack-plugin": "^2.22.0", | ||
@@ -69,0 +74,0 @@ "js-search": "^1.3.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
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
101662
8
606
0
30