How to use es6-map - 10 common examples

To help you get started, we’ve selected a few es6-map examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github medikoo / dbjs / _setup / index.js View on Github external
if (getPrototypeOf(obj) !== proto) {
			// It appears that some browsers (as Safari OSX v9.0.3) need extra slap(!) here
			console.error("This browser doesn't mind its business as it should. " +
				"Fixed prototype chain error for " + stringify(id));
			setPrototypeOf(obj, proto);
			if (getPrototypeOf(obj) !== proto) {
				throw new Error("Unrecoverable piece of shit"); // Luckily haven't happend so far
			}
		}
		objects._add(obj);
		proto._descendants_._add(obj);
		return obj;
	};

	objects._add(object = createProto(Map.prototype, 'Base#', 'object'));
	objects._add(descriptor = createProto(Map.prototype, '$', 'descriptor', object));
	objects._add(item = createProto(Object.prototype, '*', 'item', object));
	objects._add(descriptorDescriptor = createProto(Object.prototype, '/', 'sub-descriptor',
		object));

	setupProp(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupMultiple(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupDescProp(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupType(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupDescMeta(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);

	defineProperties(objects, {
github medikoo / dbjs / _setup / index.js View on Github external
obj = new Constructor(id, valueId, object, master);
		if (getPrototypeOf(obj) !== proto) {
			// It appears that some browsers (as Safari OSX v9.0.3) need extra slap(!) here
			console.error("This browser doesn't mind its business as it should. " +
				"Fixed prototype chain error for " + stringify(id));
			setPrototypeOf(obj, proto);
			if (getPrototypeOf(obj) !== proto) {
				throw new Error("Unrecoverable piece of shit"); // Luckily haven't happend so far
			}
		}
		objects._add(obj);
		proto._descendants_._add(obj);
		return obj;
	};

	objects._add(object = createProto(Map.prototype, 'Base#', 'object'));
	objects._add(descriptor = createProto(Map.prototype, '$', 'descriptor', object));
	objects._add(item = createProto(Object.prototype, '*', 'item', object));
	objects._add(descriptorDescriptor = createProto(Object.prototype, '/', 'sub-descriptor',
		object));

	setupProp(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupMultiple(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupDescProp(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupType(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
	setupDescMeta(db, createObj, object, descriptor, item, descriptorDescriptor,
		accessCollector);
github micromaomao / schsrch / view / collectioneditor.jsx View on Github external
constructor (props) {
    super(props)
    this.btnStateInterval = null
    this.handleInput = this.handleInput.bind(this)
    this.currentDOMStructure = null
    this.currentEditorNodes = new Map() // dom node -> component
    this.currentEditorNodesFromStructure = new Map() // structure item -> component
    this.inputEventMergeTimeout = null
  }
  componentDidMount () {
github micromaomao / schsrch / view / collectioneditor.jsx View on Github external
constructor (props) {
    super(props)
    this.btnStateInterval = null
    this.handleInput = this.handleInput.bind(this)
    this.currentDOMStructure = null
    this.currentEditorNodes = new Map() // dom node -> component
    this.currentEditorNodesFromStructure = new Map() // structure item -> component
    this.inputEventMergeTimeout = null
  }
  componentDidMount () {
github socialtables / openfpc / src / lib / collision-resolver.js View on Github external
constructor (bbox) {
    // set up broad-phase collision-checker
    this.quadtree = new QuadTree(
      bbox.min.x,
      bbox.min.y,
      bbox.max.x - bbox.min.x,
      bbox.max.y - bbox.min.y,
      { maxchildren: 8 }
    );

    // assign default selection radiuses
    this.pointRadius = 10;
    this.lineRadius = 4;

    // bookkeeping
    this.idToEntity = new Map();
  }
  addPoint (id, srcPoint) {
github medikoo / dbjs / test / _setup / utils / define-map-observable.js View on Github external
module.exports = function (t, a) {
	var proto = create(Map.prototype), initialized, map, event;

	t(proto, function () { initialized = true; });

	map = create(proto);
	map = proto.constructor.call(map);

	map.set('foo', 'bar');
	a(initialized, undefined, "Not observable");
	map.on('foo', function () {});
	a(initialized, undefined, "Not 'change' listener");
	map.on('change', function (e) { event = e; });
	a(initialized, true, "'change' listener");

	map.set('raz', 'dwa');
	map._emitSet_('raz', 'dwa');
	a.deep(event, { type: 'set', key: 'raz', value: 'dwa', target: map }, "Event");
github madebywild / konterball / src / javascripts / sound-manager.js View on Github external
constructor(config) {
    this.config = config;
    this.muted = false;
    this.error = true;
    this.uiSprite = new Howl({
      src: spriteConfig.urls,
      sprite: spriteConfig.sprite,
      onload: () => {
        console.log('loaded');
        this.error = false;
      },
    });
    const url = '/audio/loops/';
    this.loopSounds = new Map();
    this.loopSounds.set('bass', new Howl({
      loop: true,
      src: [
        `${url}loop1-bass.mp3`,
        `${url}loop1-bass.ogg`,
      ],
      onload: () => {
        this.loopSounds.get('bass').play();
      },
    }));
    this.loopSounds.set('bass-pad', new Howl({loop: true, src: [
      `${url}loop1-bass-pad.mp3`,
      `${url}loop1-bass-pad.ogg`,
    ]}));
    this.loopSounds.set('bass-pad-synth', new Howl({loop: true, src: [
      `${url}loop1-bass-pad-synth.mp3`,
github sx1989827 / DOClever / Desktop / node_modules / escope / src / scope.js View on Github external
/**
         * One of 'TDZ', 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
         * @member {String} Scope#type
         */
        this.type = type;
         /**
         * The scoped {@link Variable}s of this scope, as <code>{ Variable.name
         * : Variable }</code>.
         * @member {Map} Scope#set
         */
        this.set = new Map();
        /**
         * The tainted variables of this scope, as <code>{ Variable.name :
         * boolean }</code>.
         * @member {Map} Scope#taints */
        this.taints = new Map();
        /**
         * Generally, through the lexical scoping of JS you can always know
         * which variable an identifier in the source code refers to. There are
         * a few exceptions to this rule. With 'global' and 'with' scopes you
         * can only decide at runtime which variable a reference refers to.
         * Moreover, if 'eval()' is used in a scope, it might introduce new
         * bindings in this or its parent scopes.
         * All those scopes are considered 'dynamic'.
         * @member {boolean} Scope#dynamic
         */
        this.dynamic = this.type === 'global' || this.type === 'with';
        /**
         * A reference to the scope-defining syntax node.
         * @member {esprima.Node} Scope#block
         */
        this.block = block;
github gregtatum / gl-engine / lib / scene / index.js View on Github external
function Scene () {
  var graph = {
    children: new Map(),
    parent: new Map(),
    types: {}
  }

  this.flags = { changed: true }
  this.render = function doNothing () {}
  this.renderer = null

  this.add = AddNode.bind(null, this, graph)
  this.remove = RemoveNode.bind(null, this, graph)
  this.children = GetChildren.bind(null, this, graph)
  this.parent = GetParent.bind(null, graph)
  this.attachRenderer = AttachRenderer.bind(null, this)
  this.getByType = GetByType.bind(null, graph)
  this.updateTransforms = UpdateTransforms.bind(null, this, graph)
}
github sx1989827 / DOClever / Desktop / node_modules / escope / src / scope.js View on Github external
constructor(scopeManager, block) {
        super(scopeManager, 'global', null, block, false);
        this.implicit = {
            set: new Map(),
            variables: [],
            /**
            * List of {@link Reference}s that are left to be resolved (i.e. which
            * need to be linked to the variable they refer to).
            * @member {Reference[]} Scope#implicit#left
            */
            left: []
        };
    }

es6-map

ECMAScript6 Map polyfill

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular es6-map functions