draftjs-filters
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -5,6 +5,14 @@ # Change Log | ||
<a name="0.5.0"></a> | ||
# [0.5.0](https://github.com/thibaudcolas/draftjs-filters/compare/v0.4.0...v0.5.0) (2018-01-17) | ||
### Features | ||
* **filters:** add better way to filter/keep based on undefined attr ([f836563](https://github.com/thibaudcolas/draftjs-filters/commit/f836563)) | ||
<a name="0.4.0"></a> | ||
# [0.4.0](https://github.com/thibaudcolas/draftjs-filters/compare/v0.3.0...v0.4.0) (2018-01-17) | ||
### Features | ||
@@ -14,4 +22,2 @@ | ||
<a name="0.3.0"></a> | ||
@@ -54,2 +60,8 @@ | ||
<a name="0.2.2"></a> | ||
# [0.2.2](https://github.com/thibaudcolas/draftjs-filters/compare/v0.1.0...v0.2.2) (2018-01-10) | ||
Identical to 0.1.0. | ||
<a name="0.1.0"></a> | ||
@@ -56,0 +68,0 @@ |
@@ -281,6 +281,11 @@ 'use strict'; | ||
var isValid = Object.keys(whitelist).every(function (attr) { | ||
var regex = new RegExp(whitelist[attr]); | ||
var hasData = data.hasOwnProperty(attr); | ||
var check = whitelist[attr]; | ||
return hasData && regex.test(data[attr]); | ||
if (typeof check === "boolean") { | ||
var hasData = data.hasOwnProperty(attr); | ||
return check ? hasData : !hasData; | ||
} | ||
return new RegExp(check).test(data[attr]); | ||
}); | ||
@@ -287,0 +292,0 @@ |
@@ -277,6 +277,11 @@ import { CharacterMetadata, EditorState } from 'draft-js'; | ||
var isValid = Object.keys(whitelist).every(function (attr) { | ||
var regex = new RegExp(whitelist[attr]); | ||
var hasData = data.hasOwnProperty(attr); | ||
var check = whitelist[attr]; | ||
return hasData && regex.test(data[attr]); | ||
if (typeof check === "boolean") { | ||
var hasData = data.hasOwnProperty(attr); | ||
return check ? hasData : !hasData; | ||
} | ||
return new RegExp(check).test(data[attr]); | ||
}); | ||
@@ -283,0 +288,0 @@ |
{ | ||
"name": "draftjs-filters", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Filter Draft.js content to preserve only the formatting you allow", | ||
@@ -5,0 +5,0 @@ "author": "Thibaud Colas", |
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
44127
670