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

enmap

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enmap

A simple database wrapper to make sqlite database interactions much easier for beginners, with additional array helper methods.

  • 6.0.0-alpha-0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-0.92%
Maintainers
1
Weekly downloads
 
Created
Source

ENMAP V6 PRE-RELEASE ALPHA

If you use this, don't.

V5 => V6

The biggest changes in V6 is that the cache is removed, any method that previously only worked on cached data will now work on all data.

Enmap can no longer be initialised with an iterable - adding values in enmap must be done using the various set methods, not during initialisation.

All array loop methods (map, foreach, filter, find, reduce, etc) no longer have the 3rd argument, so they are no longer "identical to array methods". This is partially because this used to be all the cached values, but in reality, it's also because you're using these methods on an enmap, so why would you need access to the enmap inside those callbacks? However, each of those callbacks return an Array, not an enmap, so you can then use the regular array methods.

Renamed or alias removed

These methods still exist but have been renamed, and all duplicates deleted. No aliases remain, but it should be easy to just rename these in your code. Pay attention to the fact that some properties are now methods (.indexes is now .keys())

  • length, count => size
  • indexes => keys()
  • deleteAll => clear()
  • array() => values()
  • keyArray() => keys()
  • exists => has() with a path

Removed due to deprecation

These have been deprecated for several minor versions, as they aren't used, or useful, in the context of Enmap.

setProp, pushIn, getProp, deleteProp, removeFrom, hasProp : removed as the "path" in methods replaces them.

  • partition: easily replaced with client code using .reduce()
  • equals: Would be extremely intensive done right. Check keys() equivalence or use loops yourself!
  • defer: hasn't been relevant for a while since better-sqlite3 was added. No promises in Enmap!
  • findAll: can easily be replaced with a normal find() and function.

Deleted as no longer relevant

Since there is no longer currently a cache in Enmap, all these are completely irrelevant at this point.

If a cache is added as an option or middleware later, these options will be part of that new feature.

  • fetch()
  • fetchEverything()
  • evict()
  • changed()
  • options.fetchAll
  • options.autoFetch
  • options.polling
  • options.pollingInterval
  • options.cloneLevel

Migration todo list

This is the initial support list for Enmap v5 methods being "ported" to the new V6 infrastructure.

My initial support is only for internal use, if you're reading this, do not use enmap v6 right now

First list is for implementation without path support.

Database-specific

  • autonum
  • close

Array Methods

  • push
  • remove
  • filter
  • map
  • some
  • every
  • reduce
  • concat
  • find
  • findKey

Map methods

  • size
  • set
  • get
  • has
  • delete
  • clear
  • forEach
  • keys
  • values
  • entries

Extra Stuff

  • update
  • math
  • inc
  • dec
  • observe
  • ensure
  • destroy
  • export
  • import
  • random
  • randomKey
  • sweep
  • clone

Todo List - Prop Support

  • get
  • set
  • has
  • delete
  • update
  • math
  • inc
  • ensure
  • push
  • remove

Todo List - More

  • Autoensure

Keywords

FAQs

Package last updated on 02 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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