blank-object

WebJar for blank-object

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

blank-object
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

blank-object
WebJar for blank-object
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/stefanpenner/blank-object

Download blank-object

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/blank-object/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>blank-object</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/blank-object/
implementation 'org.webjars.npm:blank-object:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/blank-object/
implementation ("org.webjars.npm:blank-object:1.0.2")
'org.webjars.npm:blank-object:jar:1.0.2'
<dependency org="org.webjars.npm" name="blank-object" rev="1.0.2">
  <artifact name="blank-object" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='blank-object', version='1.0.2')
)
libraryDependencies += "org.webjars.npm" % "blank-object" % "1.0.2"
[org.webjars.npm/blank-object "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

blank-object

Object.create(null) turns out to be quite slow to alloc in v8, but instead if we inherit from an ancestory with proto = create(null) we have nearly the same functionallity but with dramatically faster alloc.

var BlankObject = require('blank-object');

var bo = new BlankObject();

This is designed for a presence check map[key] !== undefined since in is also slow like hasOwnProperty, delete and Object.create.

function UNDEFINED() {}
export default class Map {
  constructor() {
    this.store = new BlankObject();
  }

  has(key) {
    return this.store[key] !== undefined;
  }

  get(key) {
    let val = this.store[key];
    return val === UNDEFINED ? undefined : val;
  }

  set(key, val) {
    this.store[key] = val === undefined ? UNDEFINED : val;
  }
}

Versions

Version
1.0.2
1.0.1