datalist-interface
Advanced tools
+11
-49
@@ -1,15 +0,5 @@ | ||
| /** | ||
| * @author Titus Wormer | ||
| * @copyright 2014 Titus Wormer | ||
| * @license MIT | ||
| * @module datalist-interface | ||
| * @fileoverview Simple interface for a list functioning as a database. | ||
| */ | ||
| 'use strict'; | ||
| /* Expose. */ | ||
| module.exports = DatalistInterface; | ||
| /* Methods. */ | ||
| var proto = DatalistInterface.prototype; | ||
@@ -19,12 +9,10 @@ | ||
| proto.remove = remove; | ||
| proto.is = proto.has = is; | ||
| proto.all = proto.valueOf = proto.toJSON = all; | ||
| proto.is = is; | ||
| proto.has = is; | ||
| proto.all = all; | ||
| proto.valueOf = all; | ||
| proto.toJSON = all; | ||
| proto.toString = toString; | ||
| /** | ||
| * An interface for a list of items. | ||
| * | ||
| * @constructor | ||
| * @param {Array.<*>} values | ||
| */ | ||
| /* An interface for a list of items. */ | ||
| function DatalistInterface(values) { | ||
@@ -35,8 +23,3 @@ this.values = []; | ||
| /** | ||
| * Add all arguments. | ||
| * | ||
| * @this DatalistInterface | ||
| * @return {DatalistInterface} - Self. | ||
| */ | ||
| /* Add all arguments. */ | ||
| function add(/* values... */) { | ||
@@ -50,8 +33,3 @@ var self = this; | ||
| /** | ||
| * Remove all arguments. | ||
| * | ||
| * @this DatalistInterface | ||
| * @return {DatalistInterface} - Self. | ||
| */ | ||
| /* Remove all arguments. */ | ||
| function remove(/* values... */) { | ||
@@ -73,9 +51,3 @@ var values = this.values; | ||
| /** | ||
| * Whether or not `value` is in context. | ||
| * | ||
| * @this DatalistInterface | ||
| * @param {*} value | ||
| * @return {boolean} | ||
| */ | ||
| /* Whether or not `value` is in context. */ | ||
| function is(value) { | ||
@@ -85,8 +57,3 @@ return this.values.indexOf(value) !== -1; | ||
| /** | ||
| * Get all values. | ||
| * | ||
| * @this DatalistInterface | ||
| * @return {Array.<*>} | ||
| */ | ||
| /* Get all values. */ | ||
| function all() { | ||
@@ -96,10 +63,5 @@ return this.values.concat(); | ||
| /** | ||
| * Stringify all values. | ||
| * | ||
| * @this DatalistInterface | ||
| * @return {string} | ||
| */ | ||
| /* Stringify all values. */ | ||
| function toString() { | ||
| return this.values.toString(); | ||
| } |
+11
-29
| { | ||
| "name": "datalist-interface", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Simple interface for a list functioning as a database", | ||
@@ -11,3 +11,2 @@ "license": "MIT", | ||
| ], | ||
| "dependencies": {}, | ||
| "repository": "https://github.com/wooorm/datalist-interface", | ||
@@ -19,22 +18,17 @@ "bugs": "https://github.com/wooorm/datalist-interface/issues", | ||
| ], | ||
| "engines": { | ||
| "node": ">=0.11.0" | ||
| }, | ||
| "files": [ | ||
| "index.js" | ||
| ], | ||
| "dependencies": {}, | ||
| "devDependencies": { | ||
| "browserify": "^13.0.0", | ||
| "browserify": "^14.0.0", | ||
| "esmangle": "^1.0.0", | ||
| "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 DatalistInterface > datalist-interface.js", | ||
@@ -56,22 +50,10 @@ "build-mangle": "esmangle datalist-interface.js > datalist-interface.min.js", | ||
| "space": true, | ||
| "esnext": false, | ||
| "ignores": [ | ||
| "datalist-interface.js", | ||
| "datalist-interface.min.js" | ||
| "datalist-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"] | ||
| } | ||
| } |
+31
-26
@@ -19,28 +19,28 @@ # datalist-interface [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
| var mammals = new DatalistInterface([ | ||
| 'common vampire bat', | ||
| 'virginia opossum', | ||
| 'eastern grey kangaroo', | ||
| 'tasmanian devil', | ||
| 'human', | ||
| 'northern elephant seal', | ||
| 'fox squirrel', | ||
| 'tree pangolin', | ||
| 'african elephant', | ||
| 'platypus', | ||
| 'colugo', | ||
| 'reindeer', | ||
| 'humpback whale', | ||
| 'star-nosed mole', | ||
| 'giant panda', | ||
| 'giant armadillo', | ||
| 'plains zebra', | ||
| 'black and rufous elephant shrew' | ||
| 'common vampire bat', | ||
| 'virginia opossum', | ||
| 'eastern grey kangaroo', | ||
| 'tasmanian devil', | ||
| 'human', | ||
| 'northern elephant seal', | ||
| 'fox squirrel', | ||
| 'tree pangolin', | ||
| 'african elephant', | ||
| 'platypus', | ||
| 'colugo', | ||
| 'reindeer', | ||
| 'humpback whale', | ||
| 'star-nosed mole', | ||
| 'giant panda', | ||
| 'giant armadillo', | ||
| 'plains zebra', | ||
| 'black and rufous elephant shrew' | ||
| ]); | ||
| mammals.is('human'); // true | ||
| mammals.is('unicorn'); // false | ||
| mammals.is('human'); //=> true | ||
| mammals.is('unicorn'); //=> false | ||
| mammals.add('unicorn').is('unicorn'); // true | ||
| mammals.add('unicorn').is('unicorn'); //=> true | ||
| mammals.remove('unicorn').is('unicorn'); // false | ||
| mammals.remove('unicorn').is('unicorn'); //=> false | ||
| ``` | ||
@@ -71,4 +71,4 @@ | ||
| ```js | ||
| fish.is('shark'); // true | ||
| fish.is('human'); // false | ||
| fish.is('shark'); //=> true | ||
| fish.is('human'); //=> false | ||
| ``` | ||
@@ -107,3 +107,3 @@ | ||
| ```js | ||
| fish.all(); // ['shark', 'tuna', 'red lionfish'] | ||
| fish.all(); //=> ['shark', 'tuna', 'red lionfish'] | ||
| ``` | ||
@@ -118,5 +118,10 @@ | ||
| ```js | ||
| fish.toString(); // 'shark,tuna,red lionfish' | ||
| fish.toString(); //=> 'shark,tuna,red lionfish' | ||
| ``` | ||
| ## Related | ||
| * [`datamap-interface`](https://github.com/wooorm/datamap-interface) | ||
| — Simple interface for a map | ||
| ## License | ||
@@ -123,0 +128,0 @@ |
-16
| <!--remark setext--> | ||
| <!--lint disable no-multiple-toplevel-headings--> | ||
| 1.0.1 / 2016-08-13 | ||
| ================== | ||
| * Fix typo’s ([`65db007`](https://github.com/wooorm/datalist-interface/commit/65db007)) | ||
| 1.0.0 / 2016-08-13 | ||
| ================== | ||
| * Refactor module ([`163b637`](https://github.com/wooorm/datalist-interface/commit/163b637)) | ||
| 0.2.1 / 2015-01-06 | ||
| ================== |
7
-30%144
3.6%6249
-16.89%4
-20%47
-44.05%