Reputation: 2951
Like Java having its Collection Framework .
Is there any api available in Javascript
where
we can Store JSON object in map for key value pair and
it will be having sort functionality and
List or Vector functionality where the size will be auto growable and
HashSet/TreeSet functionality to store duplicate free Json Object or item.
EDIT:
ListI terator functionality will be there where we can traverse bi-directionally.
One More functionality it lacking is removal of item from middle of array can be achieved so that it will rearrange after.
Comparator facity will be a added advantage.
Upvotes: 10
Views: 2116
Reputation: 9
You can use the library mentioned below. Just do npm install collectiondatalib
.
Features: www.npmjs.com/package/collectiondatalib
It is really easy to use and all collections- searching- and sorting-methods are available.
Upvotes: 1
Reputation:
Javascript's built-in array is 'auto-growable', and is actually pretty similar to the functionality you'd get from Collection in Java.
If however you need something like a HashSet, you could take a look at TaffyDB, which is supposed to be a "database" of sorts for Javascript, but I think it works in-memory.
Upvotes: 1
Reputation: 665040
No. Most of these features are native to JavaScript.
Yet, there are some libraries to extend these features. E.g. underscore.js treats Objects and Arrays both as iterable collections, there exist HashMap implementations for storing values by non-string-keys etc etc. Also, nearly all of the MVC frameworks implement their own collection objects (for models) to keep up with changes on them.
Upvotes: 4
Reputation: 324627
I've implemented HashTable
with arbitrary keys and HashSet
in my jshashtable.
Upvotes: 2
Reputation: 6058
Try to look at Backbone JS I think you can use its models and collections. Web site http://backbonejs.org/ and tutorials here http://backbonetutorials.com/
Thanks,
Sultan
Upvotes: 1