Releases: Sv443-Network/CoreUtils
Releases · Sv443-Network/CoreUtils
@sv443-network/[email protected]
Patch Changes
- d4a043d: Fixed DataStore defaultData initialization
@sv443-network/[email protected]
Patch Changes
- a0a8d7e: Fixed race condition and getValue method return type in FileStorageEngine
@sv443-network/[email protected]
Patch Changes
- a011cb3: Fix FileStorageEngine path problems on Windows
@sv443-network/[email protected]
Major Changes
- 273fa5a: Removed the boolean property
__ds-${id}-encfrom theDataStoreandDataStoreEngineclasses.
Now the key__ds-${id}-enfwill hold the encoding format identifier string, ornullif not set (will get created on the next write call).
This will make it possible to switch the encoding format without compatibility issues in the near future.
You may call the storage API methods ofstoreInstance.enginemanually to implement this until it is officially supported.
Minor Changes
- 29fb048: Added
overflowVal()to conform a value to an over- & undeflowing range - 91cbe9c: Added optional abstract method
DataStoreEngine.deleteStorage()for deleting the data storage container itself. If implemented in subclasses, it will be called from the methodDataStore.deleteData() - 3cae1cb: Added
dataStoreOptionsconstructor prop to the DataStoreEngine subclasses to enable them to be used standalone. - f6465b5: Added method
NanoEmitter.onMulti()to listen to when multiple events have emitted, with fine grained options
v1.0.0
This is the initial release of CoreUtils. Most features have been originally ported from version 9.4.1 of @sv443-network/userutils
Parts of the code have been overhauled, and some features have been added:
- Additions:
- Added
capitalize()to capitalize the first letter of a string. - Added
setImmediateInterval()to set an interval that runs immediately, then again on a fixed interval. - Added
setImmediateTimeoutLoop()to set a recursivesetTimeout()loop with a fixed delay. - Added
takeRandomItemIndex(), as a mutating counterpart torandomItemIndex() - Added
truncStr()to truncate a string to a given length, optionally adding an ellipsis. - Added
valsWithin()to check if two values, rounded at the given decimal, are within a certain range of each other. - Added
scheduleExit()to schedule a Node/Deno process to exit with the given code, after the microtask queue is empty or after the given timeout.
- Added
- BREAKING CHANGES:
- Reworked
DataStore- The constructor now needs an
engineproperty that is an instance of aDataStoreEngine - Encoding with
deflate-rawwill now be enabled by default. SetcompressionFormat: nullto disable it and restore the previous behavior. - Added
DataStoreEngineclass with two implementations available out-of-the-box;FileStorageEngineandBrowserStorageEngine, for Node/Deno and browser environments respectively. Userscripts need to useBrowserStorageEngine. - Added shorthand property
compressionFormatas an alternative to the propertiesencodeDataanddecodeData - The global key
__ds_fmt_verwill now contain a global version number for DataStore-internal format integrity.
- The constructor now needs an
- Renamed
ab2str()toabtoa()andstr2ab()toatoab()to match the naming ofatob()andbtoa() - Renamed
purifyObj()topureObj()
- Reworked