Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

data-set

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-set - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0

17

index.js

@@ -1,18 +0,17 @@

var createStore = require("weakmap-shim/create-store")
var Individual = require("individual")
'use strict';
var createHash = require("./create-hash.js")
var createHash = require('./create-hash.js');
var hashStore = Individual("__DATA_SET_WEAKMAP@3", createStore())
var hashKey = '__DATA_SET_WEAK_KEY@4';
module.exports = DataSet
module.exports = DataSet;
function DataSet(elem) {
var store = hashStore(elem)
var hash = elem[hashKey];
if (!store.hash) {
store.hash = createHash(elem)
if (!hash) {
hash = elem[hashKey] = createHash(elem);
}
return store.hash
return hash;
}
{
"name": "data-set",
"version": "3.1.0",
"version": "4.0.0",
"description": "Element#dataset abstraction",

@@ -25,4 +25,5 @@ "keywords": [],

"element": "~0.1.4",
"global": "^4.2.1",
"global": "^4.3.0",
"hyperscript": "git://github.com/dominictarr/hyperscript#data-set-bump",
"min-document": "^2.12.0",
"run-browser": "^1.3.1",

@@ -29,0 +30,0 @@ "tap-spec": "^0.1.9",

@@ -1,43 +0,46 @@

var DataSet = require("./index.js")
'use strict';
var test = require("tape")
var document = require("global/document")
var element = require("element")
var DataSet = require('./index.js');
test("can fetch records out of DS", function (assert) {
var elem = document.body
var ds = DataSet(elem)
var test = require('tape');
var document = require('global/document');
ds.foo = "bar"
test('can fetch records out of DS', function t(assert) {
var elem = document.body;
var ds = DataSet(elem);
var ds2 = DataSet(elem)
ds.foo = 'bar';
assert.equal(ds2.foo, "bar")
var ds2 = DataSet(elem);
assert.end()
})
assert.equal(ds2.foo, 'bar');
assert.end();
});
test("can fetch pre existing records out of DOM", function (assert) {
var elem = element("<div data-foo='bar' data-baz='oh yeah'></div>")
test('can fetch pre existing records out of DOM', function t(assert) {
var elem = document.createElement('div');
elem.setAttribute('data-foo', 'bar');
elem.setAttribute('data-baz', 'oh yeah');
var ds = DataSet(elem)
assert.equal(ds.foo, "bar")
assert.deepEqual(ds.baz, "oh yeah")
var ds = DataSet(elem);
assert.equal(ds.foo, 'bar');
assert.deepEqual(ds.baz, 'oh yeah');
assert.end()
})
assert.end();
});
test("setting dash names", function (assert) {
var elem = document.createElement("div")
DataSet(elem)["foo-bar"] = "baz"
var elem2 = element("<div data-foo-bar='baz'></div>")
test('setting dash names', function t(assert) {
var elem = document.createElement('div');
DataSet(elem)['foo-bar'] = 'baz';
var elem2 = document.createElement('div');
elem2.setAttribute('data-foo-bar', 'baz');
var ds = DataSet(elem)
var ds2 = DataSet(elem2)
var ds = DataSet(elem);
var ds2 = DataSet(elem2);
assert.equal(ds["foo-bar"], "baz")
assert.equal(ds2["foo-bar"], "baz")
assert.equal(ds['foo-bar'], 'baz');
assert.equal(ds2['foo-bar'], 'baz');
assert.end()
})
assert.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc