Map Polyfill
Options
All
  • Public
  • Public/Protected
  • All
Menu

Map Polyfill

  • A minimal Map polyfill written in TypeScript, unit tested using Jasmine and Karma.
  • The polyfill is (mostly) full featured when comparing to the native implementation of Map.
  • Built file size is 3 KB minified.

Installation

Ensure that Node and npm are both installed.

Then, install gulp globally:

npm install -g gulp

Finally, install all development dependencies:

cd CLONED_REPO_DIR
npm install

Run the default gulp task to run the linter, run unit tests, build documentation, and build the required scripts.

Look at the gulp folder to view the available tasks to run.

Usage

If you're interested in contributing, see the Contributing section below. Otherwise, install this package via npm: map-polyfill.

The dist folder contains all you'll need to get up and running.

Documentation

The built documentation will always be located here: Documentation.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

History

See the CHANGELOG.

License

Licensed under MIT. See the full license here: license.

Index

External modules

"src/constants/MapConstants"

"src/constants/MapConstants":

es6map

es6map:

Contains the es6map namespace

author

brendenpalmer

license

MIT

namespace

weakmap

MapConstants

MapConstants:

A class used to expose constants. Intended to be consumed by whomever requires these.

class

MAP_KEY_IDENTIFIER

MAP_KEY_IDENTIFIER:

Used to get and set values for a particular object

name

MAP_KEY_IDENTIFIER

MAP_SET_THROWABLE_MESSAGE

MAP_SET_THROWABLE_MESSAGE:

The message that will be thrown if an invalid key is used as part of the set method

name

MAP_SET_THROWABLE_MESSAGE

"src/init"

"src/init":

es6map

es6map:

Contains the weakmap namespace

author

brendenpalmer

license

MIT

namespace

weakmap

"src/iterator/IMapIterator"

"src/iterator/IMapIterator":

es6map

es6map:

Contains the es6map namespace

author

brendenpalmer

license

MIT

namespace

weakmap

IMapIterator

IMapIterator:

An interface intended to be used such that the MapIterator class implements all required methods

interface

next

  • next(): any

"src/iterator/MapIterator"

"src/iterator/MapIterator":

es6map

es6map:

Contains the es6map namespace

author

brendenpalmer

license

MIT

namespace

weakmap

MapIterator

MapIterator:

A class used as a polyfill for the native MapIterator object.

class

constructor

done

done: boolean

index

index: number

map

map: Map

type

type: string

next

  • next(): any

"src/map/IMap"

"src/map/IMap":

es6map

es6map:

Contains the es6map namespace

author

brendenpalmer

license

MIT

namespace

weakmap

IMap

IMap:

An interface intended to be used such that the Map class implements all required methods

interface

clear

  • clear(): void

delete

  • delete(key: Object): boolean

entries

forEach

  • forEach(callback: Function, thisArg?: any): void
  • Parameters

    • callback: Function
    • Optional thisArg: any

    Returns void

get

  • get(key: Object): any

has

  • has(key: Object): boolean

keys

set

  • set(key: Object, value: any): void

values

"src/map/Map"

"src/map/Map":

es6map

es6map:

Contains the es6map namespace

author

brendenpalmer

license

MIT

namespace

weakmap

Map

Map:

A class used as a polyfill for the native WeakMap object. Intended to be used as a collection of key / value pairs

class

constructor

  • new Map(iterable?: Array<Array<any>>): Map
  • The constructor for a Map

    constructor

    Parameters

    • Default value iterable: Array<Array<any>> = []

      An array of arrays. The array's elements are key value pairs.

    Returns Map

keyArray

keyArray: any[]

map

map: Object

clear

  • clear(): void

delete

  • delete(key: any): boolean
  • Deletes a key from the current Map

    name

    delete

    Parameters

    • key: any

      The key to delete

    Returns boolean

    Whether or not the deletion was successful

entries

forEach

  • forEach(callback: Function, thisArg?: any): void
  • Executes the callback for each key tied to the map

    name

    forEach

    Parameters

    • callback: Function

      The callback function

    • Optional thisArg: any

      The context in which to call the callback function

    Returns void

get

  • get(key: any): any
  • Gets the value tied to a particular object used as the key for the current Map instance

    name

    get

    Parameters

    • key: any

      The key

    Returns any

    The value

has

  • has(key: any): boolean
  • Whether or not the current Map has a particular key

    name

    has

    Parameters

    • key: any

    Returns boolean

    Whether or not the WeakMap has a particular key

keys

set

  • set(key: any, value: any): void
  • Sets a value for a particular key

    name

    set

    Parameters

    • key: any

      The key

    • value: any

    Returns void

values

"src/sequencer/MapSequencer"

"src/sequencer/MapSequencer":

es6map

es6map:

Contains the es6map namespace

author

brendenpalmer

license

MIT

namespace

weakmap

MapSequencer

MapSequencer:

Class used to generate a unique sequence of numbers such that they will never overlap. Used in conjunction with MapUtils to be used as a unique value / identifier

class

constructor

identifier

identifier: number

instance

instance: MapSequencer

next

  • next(): string

getInstance

"src/utils/MapUtils"

"src/utils/MapUtils":

es6map

es6map:

Contains the es6map namespace

author

brendenpalmer

license

MIT

namespace

weakmap

MapUtils

MapUtils:

A utility class intended to be used in conjunction with the Map class

class

defineProperty

  • defineProperty(object: any): string
  • Defines a unique property that's un-enumerable if the unique property does not already exist. Otherwise, it doesn't do anything and simply returns the value of the property that's already set on the object.

    name

    defineProperty

    Parameters

    • object: any

      The object

    Returns string

    The value set

getProperty

  • getProperty(object: any): string
  • Gets the value tied to an object

    name

    getProperty

    Parameters

    • object: any

      The object

    Returns string

    The unique identifier tied to an object

isValidObject

  • isValidObject(object: any): boolean
  • Whether or not an object is valid

    name

    isValidObject

    Parameters

    • object: any

      The object to check

    Returns boolean

    Whether or not the object is value

"typings/window/window.d"

"typings/window/window.d":

Window

Window:

Custom Window type definitions

author

brendenpalmer

license

MIT

Map

Map: any

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc