Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wordpress/token-list

Package Overview
Dependencies
Maintainers
24
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/token-list - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

src/index.ts

68

build-module/index.js

@@ -10,41 +10,18 @@ /**

*
* @param {string} initialValue Initial value to assign.
* @param initialValue Initial value to assign.
*/
constructor(initialValue = '') {
this._currentValue = '';
this._valueAsArray = [];
this.value = initialValue;
// Disable reason: These are type hints on the class.
/* eslint-disable no-unused-expressions */
/** @type {string} */
this._currentValue;
/** @type {string[]} */
this._valueAsArray;
/* eslint-enable no-unused-expressions */
}
/**
* @param {Parameters<Array<string>['entries']>} args
*/
entries(...args) {
return this._valueAsArray.entries(...args);
}
/**
* @param {Parameters<Array<string>['forEach']>} args
*/
forEach(...args) {
return this._valueAsArray.forEach(...args);
}
/**
* @param {Parameters<Array<string>['keys']>} args
*/
keys(...args) {
return this._valueAsArray.keys(...args);
}
/**
* @param {Parameters<Array<string>['values']>} args
*/
values(...args) {

@@ -59,3 +36,3 @@ return this._valueAsArray.values(...args);

*
* @return {string} Token set as string.
* @return Token set as string.
*/

@@ -71,3 +48,3 @@ get value() {

*
* @param {string} value New token set as string.
* @param value New token set as string.
*/

@@ -85,3 +62,3 @@ set value(value) {

*
* @return {number} Number of tokens.
* @return Number of tokens.
*/

@@ -98,3 +75,3 @@ get length() {

*
* @return {string} Token set as string.
* @return Token set as string.
*/

@@ -110,3 +87,3 @@ toString() {

*
* @return {IterableIterator<string>} TokenList iterator.
* @return TokenList iterator.
*/

@@ -122,5 +99,5 @@ *[Symbol.iterator]() {

*
* @param {number} index Index at which to return token.
* @param index Index at which to return token.
*
* @return {string|undefined} Token at index.
* @return Token at index.
*/

@@ -136,5 +113,5 @@ item(index) {

*
* @param {string} item Token to test.
* @param item Token to test.
*
* @return {boolean} Whether token is present.
* @return Whether token is present.
*/

@@ -150,3 +127,3 @@ contains(item) {

*
* @param {...string} items Items to add.
* @param items Items to add.
*/

@@ -162,3 +139,3 @@ add(...items) {

*
* @param {...string} items Items to remove.
* @param items Items to remove.
*/

@@ -177,6 +154,6 @@ remove(...items) {

*
* @param {string} token Token to toggle.
* @param {boolean} [force] Presence to force.
* @param token Token to toggle.
* @param [force] Presence to force.
*
* @return {boolean} Whether token is present after toggle.
* @return Whether token is present after toggle.
*/

@@ -201,6 +178,6 @@ toggle(token, force) {

*
* @param {string} token Token to replace with `newToken`.
* @param {string} newToken Token to use in place of `token`.
* @param token Token to replace with `newToken`.
* @param newToken Token to use in place of `token`.
*
* @return {boolean} Whether replacement occurred.
* @return Whether replacement occurred.
*/

@@ -222,7 +199,8 @@ replace(token, newToken) {

*
* @param _token
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports
*
* @return {boolean} Whether token is supported.
* @return Whether token is supported.
*/
supports() {
supports(_token) {
return true;

@@ -229,0 +207,0 @@ }

@@ -7,45 +7,31 @@ /**

export default class TokenList {
private _currentValue;
private _valueAsArray;
/**
* Constructs a new instance of TokenList.
*
* @param {string} initialValue Initial value to assign.
* @param initialValue Initial value to assign.
*/
constructor(initialValue?: string);
entries(...args: Parameters<Array<string>['entries']>): IterableIterator<[number, string]>;
forEach(...args: Parameters<Array<string>['forEach']>): void;
keys(...args: Parameters<Array<string>['keys']>): IterableIterator<number>;
values(...args: Parameters<Array<string>['values']>): IterableIterator<string>;
/**
* Replaces the associated set with a new string value.
* Returns the associated set as string.
*
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-value
*
* @param {string} value New token set as string.
* @return Token set as string.
*/
set value(value: string);
get value(): string;
/**
* Returns the associated set as string.
* Replaces the associated set with a new string value.
*
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-value
*
* @return {string} Token set as string.
* @param value New token set as string.
*/
get value(): string;
/** @type {string} */
_currentValue: string;
/** @type {string[]} */
_valueAsArray: string[];
set value(value: string);
/**
* @param {Parameters<Array<string>['entries']>} args
*/
entries(): IterableIterator<[number, string]>;
/**
* @param {Parameters<Array<string>['forEach']>} args
*/
forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void;
/**
* @param {Parameters<Array<string>['keys']>} args
*/
keys(): IterableIterator<number>;
/**
* @param {Parameters<Array<string>['values']>} args
*/
values(): IterableIterator<string>;
/**
* Returns the number of tokens.

@@ -55,3 +41,3 @@ *

*
* @return {number} Number of tokens.
* @return Number of tokens.
*/

@@ -65,6 +51,14 @@ get length(): number;

*
* @return {string} Token set as string.
* @return Token set as string.
*/
toString(): string;
/**
* Returns an iterator for the TokenList, iterating items of the set.
*
* @see https://dom.spec.whatwg.org/#domtokenlist
*
* @return TokenList iterator.
*/
[Symbol.iterator](): IterableIterator<string>;
/**
* Returns the token with index `index`.

@@ -74,5 +68,5 @@ *

*
* @param {number} index Index at which to return token.
* @param index Index at which to return token.
*
* @return {string|undefined} Token at index.
* @return Token at index.
*/

@@ -85,5 +79,5 @@ item(index: number): string | undefined;

*
* @param {string} item Token to test.
* @param item Token to test.
*
* @return {boolean} Whether token is present.
* @return Whether token is present.
*/

@@ -96,3 +90,3 @@ contains(item: string): boolean;

*
* @param {...string} items Items to add.
* @param items Items to add.
*/

@@ -105,3 +99,3 @@ add(...items: string[]): void;

*
* @param {...string} items Items to remove.
* @param items Items to remove.
*/

@@ -117,8 +111,8 @@ remove(...items: string[]): void;

*
* @param {string} token Token to toggle.
* @param {boolean} [force] Presence to force.
* @param token Token to toggle.
* @param [force] Presence to force.
*
* @return {boolean} Whether token is present after toggle.
* @return Whether token is present after toggle.
*/
toggle(token: string, force?: boolean | undefined): boolean;
toggle(token: string, force?: boolean): boolean;
/**

@@ -130,6 +124,6 @@ * Replaces `token` with `newToken`. Returns true if `token` was replaced

*
* @param {string} token Token to replace with `newToken`.
* @param {string} newToken Token to use in place of `token`.
* @param token Token to replace with `newToken`.
* @param newToken Token to use in place of `token`.
*
* @return {boolean} Whether replacement occurred.
* @return Whether replacement occurred.
*/

@@ -143,16 +137,9 @@ replace(token: string, newToken: string): boolean;

*
* @param _token
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports
*
* @return {boolean} Whether token is supported.
* @return Whether token is supported.
*/
supports(): boolean;
/**
* Returns an iterator for the TokenList, iterating items of the set.
*
* @see https://dom.spec.whatwg.org/#domtokenlist
*
* @return {IterableIterator<string>} TokenList iterator.
*/
[Symbol.iterator](): IterableIterator<string>;
supports(_token: string): boolean;
}
//# sourceMappingURL=index.d.ts.map

@@ -16,41 +16,18 @@ "use strict";

*
* @param {string} initialValue Initial value to assign.
* @param initialValue Initial value to assign.
*/
constructor(initialValue = '') {
this._currentValue = '';
this._valueAsArray = [];
this.value = initialValue;
// Disable reason: These are type hints on the class.
/* eslint-disable no-unused-expressions */
/** @type {string} */
this._currentValue;
/** @type {string[]} */
this._valueAsArray;
/* eslint-enable no-unused-expressions */
}
/**
* @param {Parameters<Array<string>['entries']>} args
*/
entries(...args) {
return this._valueAsArray.entries(...args);
}
/**
* @param {Parameters<Array<string>['forEach']>} args
*/
forEach(...args) {
return this._valueAsArray.forEach(...args);
}
/**
* @param {Parameters<Array<string>['keys']>} args
*/
keys(...args) {
return this._valueAsArray.keys(...args);
}
/**
* @param {Parameters<Array<string>['values']>} args
*/
values(...args) {

@@ -65,3 +42,3 @@ return this._valueAsArray.values(...args);

*
* @return {string} Token set as string.
* @return Token set as string.
*/

@@ -77,3 +54,3 @@ get value() {

*
* @param {string} value New token set as string.
* @param value New token set as string.
*/

@@ -91,3 +68,3 @@ set value(value) {

*
* @return {number} Number of tokens.
* @return Number of tokens.
*/

@@ -104,3 +81,3 @@ get length() {

*
* @return {string} Token set as string.
* @return Token set as string.
*/

@@ -116,3 +93,3 @@ toString() {

*
* @return {IterableIterator<string>} TokenList iterator.
* @return TokenList iterator.
*/

@@ -128,5 +105,5 @@ *[Symbol.iterator]() {

*
* @param {number} index Index at which to return token.
* @param index Index at which to return token.
*
* @return {string|undefined} Token at index.
* @return Token at index.
*/

@@ -142,5 +119,5 @@ item(index) {

*
* @param {string} item Token to test.
* @param item Token to test.
*
* @return {boolean} Whether token is present.
* @return Whether token is present.
*/

@@ -156,3 +133,3 @@ contains(item) {

*
* @param {...string} items Items to add.
* @param items Items to add.
*/

@@ -168,3 +145,3 @@ add(...items) {

*
* @param {...string} items Items to remove.
* @param items Items to remove.
*/

@@ -183,6 +160,6 @@ remove(...items) {

*
* @param {string} token Token to toggle.
* @param {boolean} [force] Presence to force.
* @param token Token to toggle.
* @param [force] Presence to force.
*
* @return {boolean} Whether token is present after toggle.
* @return Whether token is present after toggle.
*/

@@ -207,6 +184,6 @@ toggle(token, force) {

*
* @param {string} token Token to replace with `newToken`.
* @param {string} newToken Token to use in place of `token`.
* @param token Token to replace with `newToken`.
* @param newToken Token to use in place of `token`.
*
* @return {boolean} Whether replacement occurred.
* @return Whether replacement occurred.
*/

@@ -228,7 +205,8 @@ replace(token, newToken) {

*
* @param _token
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports
*
* @return {boolean} Whether token is supported.
* @return Whether token is supported.
*/
supports() {
supports(_token) {
return true;

@@ -235,0 +213,0 @@ }

@@ -5,2 +5,8 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 3.1.0 (2024-06-15)
### Internal
- Refactor to TypeScript ([#62584](https://github.com/WordPress/gutenberg/pull/62584)).
## 3.0.0 (2024-05-31)

@@ -7,0 +13,0 @@

{
"name": "@wordpress/token-list",
"version": "3.0.1",
"version": "3.1.0",
"description": "Constructable, plain JavaScript DOMTokenList implementation, supporting non-browser runtimes.",

@@ -35,3 +35,3 @@ "author": "The WordPress Contributors",

},
"gitHead": "0e973525f7787401b5a544e0727774d52a78639f"
"gitHead": "66d3bf12e67d16deddc4b4a9ec42e1d0bed3479a"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc