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.0 to 1.0.1

122

index.js

@@ -1,18 +0,7 @@

/**
* @author Titus Wormer
* @copyright 2014 Titus Wormer
* @license MIT
* @module datamap-interface
* @fileoverview Simple interface for a map functioning as a database.
*/
'use strict';
/* Dependencies. */
var has = require('has');
/* Expose. */
module.exports = DatamapInterface;
/* Methods. */
var own = {}.hasOwnProperty;
var proto = DatamapInterface.prototype;

@@ -22,13 +11,11 @@

proto.remove = remove;
proto.all = proto.valueOf = proto.toJSON = all;
proto.all = all;
proto.valueOf = all;
proto.toJSON = all;
proto.get = get;
proto.has = proto.is = is;
proto.has = is;
proto.is = is;
proto.keys = getKeys;
/**
* An interface for a map of items.
*
* @constructor
* @param {Object.<string, *>} values
*/
/* Interface for a map of items. */
function DatamapInterface(values) {

@@ -39,8 +26,3 @@ this.map = {};

/**
* Add all `values` to `object`.
*
* @param {Object.<string, *>} object
* @param {Object.<string, *>} values
*/
/* Add all `values` to `object`. */
function addAll(object, values) {

@@ -52,8 +34,3 @@ forPropertyInObject(values, function (value, key) {

/**
* Remove every key in `keys` from `object`.
*
* @param {Object.<string, *>} object
* @param {Array.<string>} keys
*/
/* Remove every key in `keys` from `object`. */
function removeAll(object, keys) {

@@ -65,13 +42,6 @@ forValueInArray(keys, function (key) {

/**
* Add values to map.
*
* When the second argument is passed, it is treated as
/* Add values to map.
* When the second argument is given, it is treated as
* a single value and the first parameter as a key.
* Otherwise, every value in the first argument is added.
*
* @this DatamapInterface
* @param {Object.<string, *>|string} values
* @param {*} value
*/
* Otherwise, every value in the first argument is added. */
function add(values, value) {

@@ -89,12 +59,6 @@ var self = this;

/**
* Remove keys from map.
*
* When the second argument is passed, it is treated as
/* Remove keys from map.
* When the second argument is given, it is treated as
* a single value and the first parameter as a key.
* Otherwise, every value in the first argument is added.
*
* @this DatamapInterface
* @param {Array.<string>|string} keys
*/
* Otherwise, every value in the first argument is added. */
function remove(keys) {

@@ -112,8 +76,3 @@ var self = this;

/**
* Get all values.
*
* @this DatamapInterface
* @return {Object.<string, *>}
*/
/* Get all values. */
function all() {

@@ -127,8 +86,3 @@ var values = {};

/**
* Get all keys.
*
* @this DatamapInterface
* @return {Array.<string>}
*/
/* Get all keys. */
function getKeys() {

@@ -145,9 +99,3 @@ var result = [];

/**
* Get a value.
*
* @this DatamapInterface
* @param {string} key
* @return {*}
*/
/* Get a value. */
function get(key) {

@@ -157,9 +105,3 @@ return real(this.map, key) ? this.map[key] : null;

/**
* Whether or not `value` is in context.
*
* @this DatamapInterface
* @param {string} key
* @return {boolean}
*/
/* Whether or not `value` is in context. */
function is(key) {

@@ -169,8 +111,3 @@ return real(this.map, key);

/**
* Loop over an `Object`.
*
* @param {Object.<string, *>} object
* @param {function(string, *)} callback
*/
/* Loop over an `Object`. */
function forPropertyInObject(object, callback) {

@@ -186,8 +123,3 @@ var key;

/**
* Loop over an `Array`.
*
* @param {Array.<*>} array
* @param {function(*, number)} callback
*/
/* Loop over an `Array`. */
function forValueInArray(array, callback) {

@@ -202,11 +134,5 @@ var index = -1;

/**
* Detect if a key is defined on an object.
*
* @param {Object.<string, *>} object
* @param {string} key
* @return {boolean}
*/
/* Detect if a key is defined on an object. */
function real(object, key) {
return has(object, key) && object[key] !== undefined;
return own.call(object, key) && object[key] !== undefined;
}

43

package.json
{
"name": "datamap-interface",
"version": "1.0.0",
"version": "1.0.1",
"description": "Simple interface for a map functioning as a database",

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

],
"dependencies": {},
"repository": "https://github.com/wooorm/datamap-interface",

@@ -19,23 +18,17 @@ "bugs": "https://github.com/wooorm/datamap-interface/issues",

],
"engines": {
"node": ">=0.11.0"
},
"files": [
"index.js"
],
"dependencies": {},
"devDependencies": {
"browserify": "^13.0.0",
"browserify": "^14.0.0",
"esmangle": "^1.0.0",
"has": "^1.0.1",
"nyc": "^7.1.0",
"remark-cli": "^1.0.0",
"remark-comment-config": "^4.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"nyc": "^11.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.4.0",
"xo": "^0.16.0"
"xo": "^0.18.0"
},
"scripts": {
"build-md": "remark . --quiet --frail",
"build-md": "remark . -qfo",
"build-bundle": "browserify index.js -s DatamapInterface > datamap-interface.js",

@@ -57,22 +50,12 @@ "build-mangle": "esmangle datamap-interface.js > datamap-interface.min.js",

"space": true,
"esnext": false,
"ignores": [
"datamap-interface.js",
"datamap-interface.min.js"
"datamap-interface.js"
]
},
"remarkConfig": {
"output": true,
"plugins": {
"comment-config": null,
"lint": {
"heading-increment": false,
"no-duplicate-headings": false
},
"github": null,
"validate-links": null
},
"settings": {
"bullet": "*"
}
"plugins": [
"preset-wooorm"
]
}
}

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

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
```

@@ -64,7 +64,7 @@

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'
});

@@ -82,4 +82,4 @@ ```

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

@@ -94,4 +94,4 @@

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

@@ -129,3 +129,3 @@

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

@@ -158,2 +158,7 @@

## Related
* [datalist-interface](https://github.com/wooorm/datalist-interface)
— Simple interface for a list functioning as a database
## License

@@ -160,0 +165,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