New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

datamap-interface

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

datamap-interface - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

98

index.js

@@ -1,23 +0,23 @@

'use strict';
'use strict'
module.exports = DatamapInterface;
module.exports = DatamapInterface
var own = {}.hasOwnProperty;
var own = {}.hasOwnProperty
var proto = DatamapInterface.prototype;
var proto = DatamapInterface.prototype
proto.add = add;
proto.remove = remove;
proto.all = all;
proto.valueOf = all;
proto.toJSON = all;
proto.get = get;
proto.has = is;
proto.is = is;
proto.keys = getKeys;
proto.add = add
proto.remove = remove
proto.all = all
proto.valueOf = all
proto.toJSON = all
proto.get = get
proto.has = is
proto.is = is
proto.keys = getKeys
/* Interface for a map of items. */
function DatamapInterface(values) {
this.map = {};
this.add(values);
this.map = {}
this.add(values)
}

@@ -27,5 +27,7 @@

function addAll(object, values) {
forPropertyInObject(values, function (value, key) {
object[key] = value;
});
forPropertyInObject(values, set)
function set(value, key) {
object[key] = value
}
}

@@ -35,5 +37,7 @@

function removeAll(object, keys) {
forValueInArray(keys, function (key) {
object[key] = undefined;
});
forValueInArray(keys, unset)
function unset(key) {
object[key] = undefined
}
}

@@ -46,11 +50,11 @@

function add(values, value) {
var self = this;
var self = this
if (value) {
self.map[values] = value;
self.map[values] = value
} else {
addAll(self.map, values);
addAll(self.map, values)
}
return self;
return self
}

@@ -63,11 +67,11 @@

function remove(keys) {
var self = this;
var self = this
if (typeof keys === 'string') {
self.map[keys] = undefined;
self.map[keys] = undefined
} else {
removeAll(self.map, keys);
removeAll(self.map, keys)
}
return self;
return self
}

@@ -77,7 +81,7 @@

function all() {
var values = {};
var values = {}
addAll(values, this.map);
addAll(values, this.map)
return values;
return values
}

@@ -87,10 +91,12 @@

function getKeys() {
var result = [];
var index = -1;
var result = []
var index = -1
forPropertyInObject(this.map, function (value, key) {
result[++index] = key;
});
forPropertyInObject(this.map, push)
return result;
return result
function push(value, key) {
result[++index] = key
}
}

@@ -100,3 +106,3 @@

function get(key) {
return real(this.map, key) ? this.map[key] : null;
return real(this.map, key) ? this.map[key] : null
}

@@ -106,3 +112,3 @@

function is(key) {
return real(this.map, key);
return real(this.map, key)
}

@@ -112,7 +118,7 @@

function forPropertyInObject(object, callback) {
var key;
var key
for (key in object) {
if (real(object, key)) {
callback(object[key], key);
callback(object[key], key)
}

@@ -124,7 +130,7 @@ }

function forValueInArray(array, callback) {
var index = -1;
var length = array.length;
var index = -1
var length = array.length
while (++index < length) {
callback(array[index], index);
callback(array[index], index)
}

@@ -135,3 +141,3 @@ }

function real(object, key) {
return own.call(object, key) && object[key] !== undefined;
return own.call(object, key) && object[key] !== undefined
}
{
"name": "datamap-interface",
"version": "1.0.1",
"version": "1.0.2",
"description": "Simple interface for a map functioning as a database",

@@ -11,3 +11,3 @@ "license": "MIT",

],
"repository": "https://github.com/wooorm/datamap-interface",
"repository": "wooorm/datamap-interface",
"bugs": "https://github.com/wooorm/datamap-interface/issues",

@@ -23,19 +23,19 @@ "author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",

"devDependencies": {
"browserify": "^14.0.0",
"browserify": "^16.0.0",
"esmangle": "^1.0.0",
"nyc": "^11.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^3.0.0",
"prettier": "^1.12.1",
"remark-cli": "^5.0.0",
"remark-preset-wooorm": "^4.0.0",
"tape": "^4.4.0",
"xo": "^0.18.0"
"xo": "^0.20.0"
},
"scripts": {
"build-md": "remark . -qfo",
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix",
"build-bundle": "browserify index.js -s DatamapInterface > datamap-interface.js",
"build-mangle": "esmangle datamap-interface.js > datamap-interface.min.js",
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint": "xo",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run build && npm run lint && npm run test-coverage"
"test": "npm run format && npm run build && npm run test-coverage"
},

@@ -48,5 +48,17 @@ "nyc": {

},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"space": true,
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
},
"ignores": [

@@ -53,0 +65,0 @@ "datamap-interface.js"

@@ -16,3 +16,3 @@ # datamap-interface [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]

```js
var DatamapInterface = require('datamap-interface');
var DatamapInterface = require('datamap-interface')

@@ -24,10 +24,10 @@ var animals = new DatamapInterface({

human: 'mammal'
});
})
animals.get('human'); //=> 'mammal'
animals.get('unicorn'); //=> null
animals.get('human') // => 'mammal'
animals.get('unicorn') // => null
animals.add('unicorn', 'mammal').get('unicorn'); //=> 'mammal'
animals.add('unicorn', 'mammal').get('unicorn') // => 'mammal'
animals.remove('unicorn').has('unicorn'); //=> false
animals.remove('unicorn').has('unicorn') // => false
```

@@ -42,11 +42,11 @@

```js
var DatamapInterface = require('datamap-interface');
var DatamapInterface = require('datamap-interface')
var animals = new DatamapInterface({
'unicorn' : 'mystical creature',
'shark' : 'fish',
'tuna' : 'fish',
'colugo' : 'mammal',
'human' : 'mammal'
});
unicorn: 'mystical creature',
shark: 'fish',
tuna: 'fish',
colugo: 'mammal',
human: 'mammal'
})
```

@@ -63,3 +63,3 @@

```js
var DatamapInterface = require('datamap-interface');
var DatamapInterface = require('datamap-interface')

@@ -72,3 +72,3 @@ var animals = new DatamapInterface({

human: 'mammal'
});
})
```

@@ -85,4 +85,4 @@

```js
animals.has('unicorn'); //=> true
animals.has('rainbow'); //=> false
animals.has('unicorn') // => true
animals.has('rainbow') // => false
```

@@ -97,4 +97,4 @@

```js
animals.get('unicorn'); //=> 'mystical creature'
animals.get('rainbow'); //=> null
animals.get('unicorn') // => 'mystical creature'
animals.get('rainbow') // => null
```

@@ -109,5 +109,5 @@

```js
animals.add('giant grouper', 'fish');
animals.add('giant grouper', 'fish')
animals.add({dragon : 'mystical creature'});
animals.add({dragon: 'mystical creature'})
```

@@ -122,4 +122,4 @@

```js
animals.remove(['giant grouper', 'human']);
animals.remove('dragon');
animals.remove(['giant grouper', 'human'])
animals.remove('dragon')
```

@@ -134,3 +134,3 @@

```js
animals.keys(); //=> ['shark', 'tuna', 'colugo', 'unicorn']
animals.keys() // => ['shark', 'tuna', 'colugo', 'unicorn']
```

@@ -149,3 +149,3 @@

```js
animals.all();
animals.all()
```

@@ -152,0 +152,0 @@

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