Coder Social home page Coder Social logo

hashmap.js's Introduction

Hashmap.js

Hashmap.js is an Javascript lib to add Hashmaps to Javascript.

Importing Hashmap.js

To import Hashmap.js you need to add it in your html file by using:

<script src="https://cdn.zffu.ml/js/@hashmap-js/1.0/Hashmap-js-1.0.js"></script>

Using Hashmap.js

Creating your Hashmap

You can create an Hashmap by making a new HashMap object instance:

let myHashMap = new HashMap();

If you want you can specify specific required types for your HashMap:

myHashMap.setRequiredTypes(String, Number);

If you want to remove the required types you can use

myHashMap.removeRequiredTypes();

Adding content to your Hashmap

To add content to your hashmap, you will need to use the put function:

myHashMap.put(myKey, myValue);

Removing content from your Hashmap

To clear every data that is in your Hashmap you can use the clear() function:

myHashMap.clear();

Getting Content from your Hashmap

You can get a value by using the get(key) function:

let myValue = myHashMap.get(myKey);

You can also get every key that are in your hashmap by doing:

let keys = myHashMap.getKeys();

You can also get every values that are in your hashmap by doing:

let values = myHashMap.getValues();

If you need to get everything that is in your hashmap you can use:

// Normal Format
let data = myHashMap.getAll();

// Json Format
let json = myHashMap.getAllInJson();

Checking if the Hashmap contains a key or a value

You can check if your hashmap has an key or an value by using:

// KEY
let doesKeyExists = myHashMap.keyExists(myKey);

// VALUE
let doesValueExists = myHashMap.valueExists(myValue);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.