Skip to content

Releases: Sv443-Network/CoreUtils

@sv443-network/[email protected]

02 Feb 13:42
d8d0020

Choose a tag to compare

Patch Changes

  • d4a043d: Fixed DataStore defaultData initialization

@sv443-network/[email protected]

31 Jan 14:14
75a4c94

Choose a tag to compare

Patch Changes

  • a0a8d7e: Fixed race condition and getValue method return type in FileStorageEngine

@sv443-network/[email protected]

30 Jan 23:05
0eb7928

Choose a tag to compare

Patch Changes

  • a011cb3: Fix FileStorageEngine path problems on Windows

@sv443-network/[email protected]

10 Jul 14:49
595a806

Choose a tag to compare

Major Changes

  • 273fa5a: Removed the boolean property __ds-${id}-enc from the DataStore and DataStoreEngine classes.
    Now the key __ds-${id}-enf will hold the encoding format identifier string, or null if 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 of storeInstance.engine manually 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 method DataStore.deleteData()
  • 3cae1cb: Added dataStoreOptions constructor 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

01 Jun 02:00

Choose a tag to compare

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 recursive setTimeout() loop with a fixed delay.
    • Added takeRandomItemIndex(), as a mutating counterpart to randomItemIndex()
    • 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.
  • BREAKING CHANGES:
    • Reworked DataStore
      • The constructor now needs an engine property that is an instance of a DataStoreEngine
      • Encoding with deflate-raw will now be enabled by default. Set compressionFormat: null to disable it and restore the previous behavior.
      • Added DataStoreEngine class with two implementations available out-of-the-box; FileStorageEngine and BrowserStorageEngine, for Node/Deno and browser environments respectively. Userscripts need to use BrowserStorageEngine.
      • Added shorthand property compressionFormat as an alternative to the properties encodeData and decodeData
      • The global key __ds_fmt_ver will now contain a global version number for DataStore-internal format integrity.
    • Renamed ab2str() to abtoa() and str2ab() to atoab() to match the naming of atob() and btoa()
    • Renamed purifyObj() to pureObj()