@wordpress/token-list
Advanced tools
Comparing version 2.11.0 to 2.12.0
/** | ||
* External dependencies | ||
*/ | ||
import { uniq, compact, without } from 'lodash'; | ||
/** | ||
* A set of tokens. | ||
@@ -10,3 +6,2 @@ * | ||
*/ | ||
export default class TokenList { | ||
@@ -87,3 +82,3 @@ /** | ||
value = String(value); | ||
this._valueAsArray = uniq(compact(value.split(/\s+/g))); | ||
this._valueAsArray = [...new Set(value.split(/\s+/g).filter(Boolean))]; | ||
this._currentValue = this._valueAsArray.join(' '); | ||
@@ -186,3 +181,3 @@ } | ||
this.value = without(this._valueAsArray, ...items).join(' '); | ||
this.value = this._valueAsArray.filter(val => !items.includes(val)).join(' '); | ||
} | ||
@@ -189,0 +184,0 @@ /** |
@@ -8,9 +8,3 @@ "use strict"; | ||
var _lodash = require("lodash"); | ||
/** | ||
* External dependencies | ||
*/ | ||
/** | ||
* A set of tokens. | ||
@@ -95,3 +89,3 @@ * | ||
value = String(value); | ||
this._valueAsArray = (0, _lodash.uniq)((0, _lodash.compact)(value.split(/\s+/g))); | ||
this._valueAsArray = [...new Set(value.split(/\s+/g).filter(Boolean))]; | ||
this._currentValue = this._valueAsArray.join(' '); | ||
@@ -194,3 +188,3 @@ } | ||
this.value = (0, _lodash.without)(this._valueAsArray, ...items).join(' '); | ||
this.value = this._valueAsArray.filter(val => !items.includes(val)).join(' '); | ||
} | ||
@@ -197,0 +191,0 @@ /** |
@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
## 2.12.0 (2022-06-29) | ||
## 2.11.0 (2022-06-15) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "@wordpress/token-list", | ||
"version": "2.11.0", | ||
"version": "2.12.0", | ||
"description": "Constructable, plain JavaScript DOMTokenList implementation, supporting non-browser runtimes.", | ||
@@ -29,4 +29,3 @@ "author": "The WordPress Contributors", | ||
"dependencies": { | ||
"@babel/runtime": "^7.16.0", | ||
"lodash": "^4.17.21" | ||
"@babel/runtime": "^7.16.0" | ||
}, | ||
@@ -36,3 +35,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "48d5f37dfb52d2e77c8eeb662f9874cf141b8c6b" | ||
"gitHead": "a80eeb62ec7cb1418b9915c277e084a29d6665e3" | ||
} |
/** | ||
* External dependencies | ||
*/ | ||
import { uniq, compact, without } from 'lodash'; | ||
/** | ||
* A set of tokens. | ||
@@ -78,3 +73,5 @@ * | ||
value = String( value ); | ||
this._valueAsArray = uniq( compact( value.split( /\s+/g ) ) ); | ||
this._valueAsArray = [ | ||
...new Set( value.split( /\s+/g ).filter( Boolean ) ), | ||
]; | ||
this._currentValue = this._valueAsArray.join( ' ' ); | ||
@@ -162,3 +159,5 @@ } | ||
remove( ...items ) { | ||
this.value = without( this._valueAsArray, ...items ).join( ' ' ); | ||
this.value = this._valueAsArray | ||
.filter( ( val ) => ! items.includes( val ) ) | ||
.join( ' ' ); | ||
} | ||
@@ -165,0 +164,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1
96796
991
- Removedlodash@^4.17.21
- Removedlodash@4.17.21(transitive)