参考 p5.TypedDict

p5.TypedDict

Base class for all p5.Dictionary types. Specifically typed Dictionary classes inherit from this class.

方法

size

Returns the number of key-value pairs currently stored in the Dictionary.

hasKey

Returns true if the given key exists in the Dictionary, otherwise returns false.

get

Returns the value stored at the given key.

set

Updates the value associated with the given key in case it already exists in the Dictionary. Otherwise a new key-value pair is added.

create

Creates a new key-value pair in the Dictionary.

clear

Removes all previously stored key-value pairs from the Dictionary.

remove

Removes the key-value pair stored at the given key from the Dictionary.

print

Logs the set of items currently stored in the Dictionary to the console.

saveTable

Converts the Dictionary into a CSV file for local download.

saveJSON

Converts the Dictionary into a JSON file for local download.

Notice any errors or typos? Please let us know. Please feel free to edit src/data/p5.TypedDict.js and open a pull request!

相关参考