datalist-interface
Advanced tools
+25
-25
@@ -1,20 +0,20 @@ | ||
| 'use strict'; | ||
| 'use strict' | ||
| module.exports = DatalistInterface; | ||
| module.exports = DatalistInterface | ||
| var proto = DatalistInterface.prototype; | ||
| var proto = DatalistInterface.prototype | ||
| proto.add = add; | ||
| proto.remove = remove; | ||
| proto.is = is; | ||
| proto.has = is; | ||
| proto.all = all; | ||
| proto.valueOf = all; | ||
| proto.toJSON = all; | ||
| proto.toString = toString; | ||
| proto.add = add | ||
| proto.remove = remove | ||
| 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. */ | ||
| function DatalistInterface(values) { | ||
| this.values = []; | ||
| this.add.apply(this, values); | ||
| this.values = [] | ||
| this.add.apply(this, values) | ||
| } | ||
@@ -24,7 +24,7 @@ | ||
| function add(/* values... */) { | ||
| var self = this; | ||
| var self = this | ||
| self.values.push.apply(self.values, arguments); | ||
| self.values.push.apply(self.values, arguments) | ||
| return self; | ||
| return self | ||
| } | ||
@@ -34,15 +34,15 @@ | ||
| function remove(/* values... */) { | ||
| var values = this.values; | ||
| var index = arguments.length; | ||
| var position; | ||
| var values = this.values | ||
| var index = arguments.length | ||
| var position | ||
| while (index--) { | ||
| position = values.indexOf(arguments[index]); | ||
| position = values.indexOf(arguments[index]) | ||
| if (position !== -1) { | ||
| values.splice(position, 1); | ||
| values.splice(position, 1) | ||
| } | ||
| } | ||
| return this; | ||
| return this | ||
| } | ||
@@ -52,3 +52,3 @@ | ||
| function is(value) { | ||
| return this.values.indexOf(value) !== -1; | ||
| return this.values.indexOf(value) !== -1 | ||
| } | ||
@@ -58,3 +58,3 @@ | ||
| function all() { | ||
| return this.values.concat(); | ||
| return this.values.concat() | ||
| } | ||
@@ -64,3 +64,3 @@ | ||
| function toString() { | ||
| return this.values.toString(); | ||
| return this.values.toString() | ||
| } |
+25
-11
| { | ||
| "name": "datalist-interface", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "Simple interface for a list functioning as a database", | ||
@@ -22,19 +22,19 @@ "license": "MIT", | ||
| "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 DatalistInterface > datalist-interface.js", | ||
| "build-mangle": "esmangle datalist-interface.js > datalist-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" | ||
| }, | ||
@@ -47,5 +47,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": [ | ||
@@ -56,4 +68,6 @@ "datalist-interface.js" | ||
| "remarkConfig": { | ||
| "plugins": ["preset-wooorm"] | ||
| "plugins": [ | ||
| "preset-wooorm" | ||
| ] | ||
| } | ||
| } |
+14
-14
@@ -16,3 +16,3 @@ # datalist-interface [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
| ```js | ||
| var DatalistInterface = require('datalist-interface'); | ||
| var DatalistInterface = require('datalist-interface') | ||
@@ -38,10 +38,10 @@ var mammals = new DatalistInterface([ | ||
| '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 | ||
| ``` | ||
@@ -58,5 +58,5 @@ | ||
| ```js | ||
| var DatalistInterface = require('datalist-interface'); | ||
| var DatalistInterface = require('datalist-interface') | ||
| var fish = new DatalistInterface(['shark', 'tuna']); | ||
| var fish = new DatalistInterface(['shark', 'tuna']) | ||
| ``` | ||
@@ -73,4 +73,4 @@ | ||
| ```js | ||
| fish.is('shark'); //=> true | ||
| fish.is('human'); //=> false | ||
| fish.is('shark') // => true | ||
| fish.is('human') // => false | ||
| ``` | ||
@@ -85,3 +85,3 @@ | ||
| ```js | ||
| fish.add('giant grouper', 'red lionfish'); | ||
| fish.add('giant grouper', 'red lionfish') | ||
| ``` | ||
@@ -96,3 +96,3 @@ | ||
| ```js | ||
| fish.remove('giant grouper', 'reindeer'); | ||
| fish.remove('giant grouper', 'reindeer') | ||
| ``` | ||
@@ -111,3 +111,3 @@ | ||
| ```js | ||
| fish.all(); //=> ['shark', 'tuna', 'red lionfish'] | ||
| fish.all() // => ['shark', 'tuna', 'red lionfish'] | ||
| ``` | ||
@@ -122,3 +122,3 @@ | ||
| ```js | ||
| fish.toString(); //=> 'shark,tuna,red lionfish' | ||
| fish.toString() // => 'shark,tuna,red lionfish' | ||
| ``` | ||
@@ -125,0 +125,0 @@ |
6509
4.16%8
14.29%