feat: use Yarn workspaces
Much faster installation which is very important for CI. We'll see if it proves difficult for deps management.
This commit is contained in:
		@@ -6,3 +6,10 @@ node_js:
 | 
				
			|||||||
# Use containers.
 | 
					# Use containers.
 | 
				
			||||||
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
 | 
					# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
 | 
				
			||||||
sudo: false
 | 
					sudo: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					before_install:
 | 
				
			||||||
 | 
					  - curl -o- -L https://yarnpkg.com/install.sh | bash
 | 
				
			||||||
 | 
					  - export PATH="$HOME/.yarn/bin:$PATH"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cache:
 | 
				
			||||||
 | 
					  yarn: true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "lerna": "2.3.1",
 | 
					 | 
				
			||||||
  "npmClient": "yarn",
 | 
					 | 
				
			||||||
  "packages": [
 | 
					 | 
				
			||||||
    "packages/*"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "version": "0.0.0"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										15
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								package.json
									
									
									
									
									
								
							@@ -1,12 +1,19 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
 | 
					    "exec-promise": "^0.7.0",
 | 
				
			||||||
    "husky": "^0.14.3",
 | 
					    "husky": "^0.14.3",
 | 
				
			||||||
    "lerna": "^2.3.1",
 | 
					 | 
				
			||||||
    "promise-toolbox": "^0.9.5"
 | 
					    "promise-toolbox": "^0.9.5"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					  "engines": {
 | 
				
			||||||
 | 
					    "yarn": "^1.2.1"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "private": true,
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "commitmsg": "yarn test",
 | 
					    "commitmsg": "yarn test",
 | 
				
			||||||
    "install": "lerna bootstrap",
 | 
					    "prepublish": "scripts/run-script prepublish",
 | 
				
			||||||
    "test": "lerna run test"
 | 
					    "test": "scripts/run-script test"
 | 
				
			||||||
  }
 | 
					  },
 | 
				
			||||||
 | 
					  "workspaces": [
 | 
				
			||||||
 | 
					    "packages/*"
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,18 +29,18 @@
 | 
				
			|||||||
    "@nraynaud/struct-fu": "^1.0.1",
 | 
					    "@nraynaud/struct-fu": "^1.0.1",
 | 
				
			||||||
    "@nraynaud/xo-fs": "^0.0.5",
 | 
					    "@nraynaud/xo-fs": "^0.0.5",
 | 
				
			||||||
    "babel-runtime": "^6.22.0",
 | 
					    "babel-runtime": "^6.22.0",
 | 
				
			||||||
    "exec-promise": "^0.6.1"
 | 
					    "exec-promise": "^0.7.0"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.24.1",
 | 
					    "babel-preset-stage-3": "^6.24.1",
 | 
				
			||||||
    "cross-env": "^5.0.1",
 | 
					    "cross-env": "^5.0.1",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "jest": "^20.0.4",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.2"
 | 
					    "standard": "^10.0.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,30 +0,0 @@
 | 
				
			|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 | 
					 | 
				
			||||||
# yarn lockfile v1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end-of-stream@^1.1.0:
 | 
					 | 
				
			||||||
  version "1.4.0"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.0.tgz#7a90d833efda6cfa6eac0f4949dbb0fad3a63206"
 | 
					 | 
				
			||||||
  dependencies:
 | 
					 | 
				
			||||||
    once "^1.4.0"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
golike-defer@^0.1.0:
 | 
					 | 
				
			||||||
  version "0.1.0"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/golike-defer/-/golike-defer-0.1.0.tgz#70a3d8991cdfe41845956bfb578f69bc3e49f525"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
once@^1.3.1, once@^1.4.0:
 | 
					 | 
				
			||||||
  version "1.4.0"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
 | 
					 | 
				
			||||||
  dependencies:
 | 
					 | 
				
			||||||
    wrappy "1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
pump@^1.0.2:
 | 
					 | 
				
			||||||
  version "1.0.2"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.2.tgz#3b3ee6512f94f0e575538c17995f9f16990a5d51"
 | 
					 | 
				
			||||||
  dependencies:
 | 
					 | 
				
			||||||
    end-of-stream "^1.1.0"
 | 
					 | 
				
			||||||
    once "^1.3.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
wrappy@1:
 | 
					 | 
				
			||||||
  version "1.0.2"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
 | 
					 | 
				
			||||||
@@ -52,14 +52,14 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
 | 
					    "babel-plugin-transform-decorators-legacy": "^1.3.4",
 | 
				
			||||||
    "babel-preset-env": "^1.6.0",
 | 
					    "babel-preset-env": "^1.6.0",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.24.1",
 | 
					    "babel-preset-stage-0": "^6.24.1",
 | 
				
			||||||
    "cross-env": "^5.0.5",
 | 
					    "cross-env": "^5.0.5",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "jest": "^20.0.4",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.3"
 | 
					    "standard": "^10.0.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -25,7 +25,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-preset-es2015": "^6.24.1",
 | 
					    "babel-preset-es2015": "^6.24.1",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.24.1",
 | 
					    "babel-preset-stage-0": "^6.24.1",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,90 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  // Julien Fontanet JSHint configuration
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Changes from defaults:
 | 
					 | 
				
			||||||
  // - all enforcing options (except `++` & `--`) enabled
 | 
					 | 
				
			||||||
  // - single quotes
 | 
					 | 
				
			||||||
  // - indentation set to 2 instead of 4
 | 
					 | 
				
			||||||
  // - almost all relaxing options disabled
 | 
					 | 
				
			||||||
  // - allow expression statements (necessary for chai.expect())
 | 
					 | 
				
			||||||
  // - allow global strict (most of my devs are in Node.js or Browserify)
 | 
					 | 
				
			||||||
  // - environments are set to Browserify, mocha & Node.js
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // See http://jshint.com/docs/ for more details
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  "maxerr"        : 50,       // {int} Maximum error before stopping
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Enforcing
 | 
					 | 
				
			||||||
  "bitwise"       : true,     // true: Prohibit bitwise operators (&, |, ^, etc.)
 | 
					 | 
				
			||||||
  "camelcase"     : true,     // true: Identifiers must be in camelCase
 | 
					 | 
				
			||||||
  "curly"         : true,     // true: Require {} for every new block or scope
 | 
					 | 
				
			||||||
  "eqeqeq"        : true,     // true: Require triple equals (===) for comparison
 | 
					 | 
				
			||||||
  "forin"         : true,     // true: Require filtering for..in loops with obj.hasOwnProperty()
 | 
					 | 
				
			||||||
  "immed"         : true,     // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
 | 
					 | 
				
			||||||
  "indent"        : 2,        // {int} Number of spaces to use for indentation
 | 
					 | 
				
			||||||
  "latedef"       : true,     // true: Require variables/functions to be defined before being used
 | 
					 | 
				
			||||||
  "newcap"        : true,     // true: Require capitalization of all constructor functions e.g. `new F()`
 | 
					 | 
				
			||||||
  "noarg"         : true,     // true: Prohibit use of `arguments.caller` and `arguments.callee`
 | 
					 | 
				
			||||||
  "noempty"       : true,     // true: Prohibit use of empty blocks
 | 
					 | 
				
			||||||
  "nonew"         : true,     // true: Prohibit use of constructors for side-effects (without assignment)
 | 
					 | 
				
			||||||
  "plusplus"      : false,    // true: Prohibit use of `++` & `--`
 | 
					 | 
				
			||||||
  "quotmark"      : "single", // Quotation mark consistency:
 | 
					 | 
				
			||||||
                              //   false    : do nothing (default)
 | 
					 | 
				
			||||||
                              //   true     : ensure whatever is used is consistent
 | 
					 | 
				
			||||||
                              //   "single" : require single quotes
 | 
					 | 
				
			||||||
                              //   "double" : require double quotes
 | 
					 | 
				
			||||||
  "undef"         : true,     // true: Require all non-global variables to be declared (prevents global leaks)
 | 
					 | 
				
			||||||
  "unused"        : true,     // true: Require all defined variables be used
 | 
					 | 
				
			||||||
  "strict"        : true,     // true: Requires all functions run in ES5 Strict Mode
 | 
					 | 
				
			||||||
  "maxparams"     : 4,        // {int} Max number of formal params allowed per function
 | 
					 | 
				
			||||||
  "maxdepth"      : 3,        // {int} Max depth of nested blocks (within functions)
 | 
					 | 
				
			||||||
  "maxstatements" : 20,       // {int} Max number statements per function
 | 
					 | 
				
			||||||
  "maxcomplexity" : 7,        // {int} Max cyclomatic complexity per function
 | 
					 | 
				
			||||||
  "maxlen"        : 80,       // {int} Max number of characters per line
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Relaxing
 | 
					 | 
				
			||||||
  "asi"           : false,     // true: Tolerate Automatic Semicolon Insertion (no semicolons)
 | 
					 | 
				
			||||||
  "boss"          : false,     // true: Tolerate assignments where comparisons would be expected
 | 
					 | 
				
			||||||
  "debug"         : false,     // true: Allow debugger statements e.g. browser breakpoints.
 | 
					 | 
				
			||||||
  "eqnull"        : false,     // true: Tolerate use of `== null`
 | 
					 | 
				
			||||||
  "es5"           : false,     // true: Allow ES5 syntax (ex: getters and setters)
 | 
					 | 
				
			||||||
  "esnext"        : false,     // true: Allow ES.next (ES6) syntax (ex: `const`)
 | 
					 | 
				
			||||||
  "moz"           : false,     // true: Allow Mozilla specific syntax (extends and overrides esnext features)
 | 
					 | 
				
			||||||
                               // (ex: `for each`, multiple try/catch, function expression…)
 | 
					 | 
				
			||||||
  "evil"          : false,     // true: Tolerate use of `eval` and `new Function()`
 | 
					 | 
				
			||||||
  "expr"          : true,      // true: Tolerate `ExpressionStatement` as Programs
 | 
					 | 
				
			||||||
  "funcscope"     : false,     // true: Tolerate defining variables inside control statements
 | 
					 | 
				
			||||||
  "globalstrict"  : true,      // true: Allow global "use strict" (also enables 'strict')
 | 
					 | 
				
			||||||
  "iterator"      : false,     // true: Tolerate using the `__iterator__` property
 | 
					 | 
				
			||||||
  "lastsemic"     : false,     // true: Tolerate omitting a semicolon for the last statement of a 1-line block
 | 
					 | 
				
			||||||
  "laxbreak"      : false,     // true: Tolerate possibly unsafe line breakings
 | 
					 | 
				
			||||||
  "laxcomma"      : false,     // true: Tolerate comma-first style coding
 | 
					 | 
				
			||||||
  "loopfunc"      : false,     // true: Tolerate functions being defined in loops
 | 
					 | 
				
			||||||
  "multistr"      : false,     // true: Tolerate multi-line strings
 | 
					 | 
				
			||||||
  "proto"         : false,     // true: Tolerate using the `__proto__` property
 | 
					 | 
				
			||||||
  "scripturl"     : false,     // true: Tolerate script-targeted URLs
 | 
					 | 
				
			||||||
  "shadow"        : false,     // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
 | 
					 | 
				
			||||||
  "sub"           : false,     // true: Tolerate using `[]` notation when it can still be expressed in dot notation
 | 
					 | 
				
			||||||
  "supernew"      : false,     // true: Tolerate `new function () { ... };` and `new Object;`
 | 
					 | 
				
			||||||
  "validthis"     : false,     // true: Tolerate using this in a non-constructor function
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Environments
 | 
					 | 
				
			||||||
  "browser"       : false,    // Web Browser (window, document, etc)
 | 
					 | 
				
			||||||
  "browserify"    : true,     // Browserify (node.js code in the browser)
 | 
					 | 
				
			||||||
  "couch"         : false,    // CouchDB
 | 
					 | 
				
			||||||
  "devel"         : true,     // Development/debugging (alert, confirm, etc)
 | 
					 | 
				
			||||||
  "dojo"          : false,    // Dojo Toolkit
 | 
					 | 
				
			||||||
  "jquery"        : false,    // jQuery
 | 
					 | 
				
			||||||
  "mocha"         : true,     // mocha
 | 
					 | 
				
			||||||
  "mootools"      : false,    // MooTools
 | 
					 | 
				
			||||||
  "node"          : true,     // Node.js
 | 
					 | 
				
			||||||
  "nonstandard"   : false,    // Widely adopted globals (escape, unescape, etc)
 | 
					 | 
				
			||||||
  "prototypejs"   : false,    // Prototype and Scriptaculous
 | 
					 | 
				
			||||||
  "rhino"         : false,    // Rhino
 | 
					 | 
				
			||||||
  "worker"        : false,    // Web Workers
 | 
					 | 
				
			||||||
  "wsh"           : false,    // Windows Scripting Host
 | 
					 | 
				
			||||||
  "yui"           : false,    // Yahoo User Interface
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Custom Globals
 | 
					 | 
				
			||||||
  "globals"       : {}        // additional predefined global variables
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -32,7 +32,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
@@ -40,7 +40,7 @@
 | 
				
			|||||||
    "cross-env": "^5.0.1",
 | 
					    "cross-env": "^5.0.1",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "event-to-promise": "^0.8.0",
 | 
					    "event-to-promise": "^0.8.0",
 | 
				
			||||||
    "jest": "^19.0.2",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.2"
 | 
					    "standard": "^10.0.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,15 +23,16 @@ function waitTicks (n = 2) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('Collection', function () {
 | 
					describe('Collection', function () {
 | 
				
			||||||
 | 
					  let col
 | 
				
			||||||
  beforeEach(function () {
 | 
					  beforeEach(function () {
 | 
				
			||||||
    this.col = new Collection()
 | 
					    col = new Collection()
 | 
				
			||||||
    this.col.add('bar', 0)
 | 
					    col.add('bar', 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return waitTicks()
 | 
					    return waitTicks()
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it.only('is iterable', function () {
 | 
					  it('is iterable', function () {
 | 
				
			||||||
    const iterator = this.col[Symbol.iterator]()
 | 
					    const iterator = col[Symbol.iterator]()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    expect(iterator.next()).toEqual({done: false, value: ['bar', 0]})
 | 
					    expect(iterator.next()).toEqual({done: false, value: ['bar', 0]})
 | 
				
			||||||
    expect(iterator.next()).toEqual({done: true, value: undefined})
 | 
					    expect(iterator.next()).toEqual({done: true, value: undefined})
 | 
				
			||||||
@@ -39,7 +40,7 @@ describe('Collection', function () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe('#keys()', function () {
 | 
					  describe('#keys()', function () {
 | 
				
			||||||
    it('returns an iterator over the keys', function () {
 | 
					    it('returns an iterator over the keys', function () {
 | 
				
			||||||
      const iterator = this.col.keys()
 | 
					      const iterator = col.keys()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(iterator.next()).toEqual({done: false, value: 'bar'})
 | 
					      expect(iterator.next()).toEqual({done: false, value: 'bar'})
 | 
				
			||||||
      expect(iterator.next()).toEqual({done: true, value: undefined})
 | 
					      expect(iterator.next()).toEqual({done: true, value: undefined})
 | 
				
			||||||
@@ -48,7 +49,7 @@ describe('Collection', function () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe('#values()', function () {
 | 
					  describe('#values()', function () {
 | 
				
			||||||
    it('returns an iterator over the values', function () {
 | 
					    it('returns an iterator over the values', function () {
 | 
				
			||||||
      const iterator = this.col.values()
 | 
					      const iterator = col.values()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(iterator.next()).toEqual({done: false, value: 0})
 | 
					      expect(iterator.next()).toEqual({done: false, value: 0})
 | 
				
			||||||
      expect(iterator.next()).toEqual({done: true, value: undefined})
 | 
					      expect(iterator.next()).toEqual({done: true, value: undefined})
 | 
				
			||||||
@@ -58,114 +59,114 @@ describe('Collection', function () {
 | 
				
			|||||||
  describe('#add()', function () {
 | 
					  describe('#add()', function () {
 | 
				
			||||||
    it('adds item to the collection', function () {
 | 
					    it('adds item to the collection', function () {
 | 
				
			||||||
      const spy = jest.fn()
 | 
					      const spy = jest.fn()
 | 
				
			||||||
      this.col.on('add', spy)
 | 
					      col.on('add', spy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.add('foo', true)
 | 
					      col.add('foo', true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.get('foo')).toBe(true)
 | 
					      expect(col.get('foo')).toBe(true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // No sync events.
 | 
					      // No sync events.
 | 
				
			||||||
      expect(spy).not.toHaveBeenCalled()
 | 
					      expect(spy).not.toHaveBeenCalled()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Async event.
 | 
					      // Async event.
 | 
				
			||||||
      return eventToPromise(this.col, 'add').then(function (added) {
 | 
					      return eventToPromise(col, 'add').then(function (added) {
 | 
				
			||||||
        expect(Object.keys(added)).toEqual([ 'foo' ])
 | 
					        expect(Object.keys(added)).toEqual([ 'foo' ])
 | 
				
			||||||
        expect(added.foo).toBe(true)
 | 
					        expect(added.foo).toBe(true)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('throws an exception if the item already exists', function () {
 | 
					    it('throws an exception if the item already exists', function () {
 | 
				
			||||||
      expect(() => this.col.add('bar', true)).toThrowError(DuplicateItem)
 | 
					      expect(() => col.add('bar', true)).toThrowError(DuplicateItem)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('accepts an object with an id property', function () {
 | 
					    it('accepts an object with an id property', function () {
 | 
				
			||||||
      const foo = { id: 'foo' }
 | 
					      const foo = { id: 'foo' }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.add(foo)
 | 
					      col.add(foo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.get(foo.id)).toBe(foo)
 | 
					      expect(col.get(foo.id)).toBe(foo)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('#update()', function () {
 | 
					  describe('#update()', function () {
 | 
				
			||||||
    it('updates an item of the collection', function () {
 | 
					    it('updates an item of the collection', function () {
 | 
				
			||||||
      const spy = jest.fn()
 | 
					      const spy = jest.fn()
 | 
				
			||||||
      this.col.on('update', spy)
 | 
					      col.on('update', spy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.update('bar', 1)
 | 
					      col.update('bar', 1)
 | 
				
			||||||
      expect(this.col.get('bar')).toBe(1) // Will be forgotten by de-duplication
 | 
					      expect(col.get('bar')).toBe(1) // Will be forgotten by de-duplication
 | 
				
			||||||
      this.col.update('bar', 2)
 | 
					      col.update('bar', 2)
 | 
				
			||||||
      expect(this.col.get('bar')).toBe(2)
 | 
					      expect(col.get('bar')).toBe(2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // No sync events.
 | 
					      // No sync events.
 | 
				
			||||||
      expect(spy).not.toHaveBeenCalled()
 | 
					      expect(spy).not.toHaveBeenCalled()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Async event.
 | 
					      // Async event.
 | 
				
			||||||
      return eventToPromise(this.col, 'update').then(function (updated) {
 | 
					      return eventToPromise(col, 'update').then(function (updated) {
 | 
				
			||||||
        expect(Object.keys(updated)).toEqual(['bar'])
 | 
					        expect(Object.keys(updated)).toEqual(['bar'])
 | 
				
			||||||
        expect(updated.bar).toBe(2)
 | 
					        expect(updated.bar).toBe(2)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('throws an exception if the item does not exist', function () {
 | 
					    it('throws an exception if the item does not exist', function () {
 | 
				
			||||||
      expect(() => this.col.update('baz', true)).toThrowError(NoSuchItem)
 | 
					      expect(() => col.update('baz', true)).toThrowError(NoSuchItem)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('accepts an object with an id property', function () {
 | 
					    it('accepts an object with an id property', function () {
 | 
				
			||||||
      const bar = { id: 'bar' }
 | 
					      const bar = { id: 'bar' }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.update(bar)
 | 
					      col.update(bar)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.get(bar.id)).toBe(bar)
 | 
					      expect(col.get(bar.id)).toBe(bar)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('#remove()', function () {
 | 
					  describe('#remove()', function () {
 | 
				
			||||||
    it('removes an item of the collection', function () {
 | 
					    it('removes an item of the collection', function () {
 | 
				
			||||||
      const spy = jest.fn()
 | 
					      const spy = jest.fn()
 | 
				
			||||||
      this.col.on('remove', spy)
 | 
					      col.on('remove', spy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.update('bar', 1)
 | 
					      col.update('bar', 1)
 | 
				
			||||||
      expect(this.col.get('bar')).toBe(1) // Will be forgotten by de-duplication
 | 
					      expect(col.get('bar')).toBe(1) // Will be forgotten by de-duplication
 | 
				
			||||||
      this.col.remove('bar')
 | 
					      col.remove('bar')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // No sync events.
 | 
					      // No sync events.
 | 
				
			||||||
      expect(spy).not.toHaveBeenCalled()
 | 
					      expect(spy).not.toHaveBeenCalled()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Async event.
 | 
					      // Async event.
 | 
				
			||||||
      return eventToPromise(this.col, 'remove').then(function (removed) {
 | 
					      return eventToPromise(col, 'remove').then(function (removed) {
 | 
				
			||||||
        expect(Object.keys(removed)).toEqual(['bar'])
 | 
					        expect(Object.keys(removed)).toEqual(['bar'])
 | 
				
			||||||
        expect(removed.bar).toBeUndefined()
 | 
					        expect(removed.bar).toBeUndefined()
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('throws an exception if the item does not exist', function () {
 | 
					    it('throws an exception if the item does not exist', function () {
 | 
				
			||||||
      expect(() => this.col.remove('baz', true)).toThrowError(NoSuchItem)
 | 
					      expect(() => col.remove('baz', true)).toThrowError(NoSuchItem)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('accepts an object with an id property', function () {
 | 
					    it('accepts an object with an id property', function () {
 | 
				
			||||||
      const bar = { id: 'bar' }
 | 
					      const bar = { id: 'bar' }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.remove(bar)
 | 
					      col.remove(bar)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.has(bar.id)).toBe(false)
 | 
					      expect(col.has(bar.id)).toBe(false)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('#set()', function () {
 | 
					  describe('#set()', function () {
 | 
				
			||||||
    it('adds item if collection has not key', function () {
 | 
					    it('adds item if collection has not key', function () {
 | 
				
			||||||
      const spy = jest.fn()
 | 
					      const spy = jest.fn()
 | 
				
			||||||
      this.col.on('add', spy)
 | 
					      col.on('add', spy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.set('foo', true)
 | 
					      col.set('foo', true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.get('foo')).toBe(true)
 | 
					      expect(col.get('foo')).toBe(true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // No sync events.
 | 
					      // No sync events.
 | 
				
			||||||
      expect(spy).not.toHaveBeenCalled()
 | 
					      expect(spy).not.toHaveBeenCalled()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Async events.
 | 
					      // Async events.
 | 
				
			||||||
      return eventToPromise(this.col, 'add').then(function (added) {
 | 
					      return eventToPromise(col, 'add').then(function (added) {
 | 
				
			||||||
        expect(Object.keys(added)).toEqual(['foo'])
 | 
					        expect(Object.keys(added)).toEqual(['foo'])
 | 
				
			||||||
        expect(added.foo).toBe(true)
 | 
					        expect(added.foo).toBe(true)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
@@ -173,17 +174,17 @@ describe('Collection', function () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    it('updates item if collection has key', function () {
 | 
					    it('updates item if collection has key', function () {
 | 
				
			||||||
      const spy = jest.fn()
 | 
					      const spy = jest.fn()
 | 
				
			||||||
      this.col.on('udpate', spy)
 | 
					      col.on('udpate', spy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.set('bar', 1)
 | 
					      col.set('bar', 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.get('bar')).toBe(1)
 | 
					      expect(col.get('bar')).toBe(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // No sync events.
 | 
					      // No sync events.
 | 
				
			||||||
      expect(spy).not.toHaveBeenCalled()
 | 
					      expect(spy).not.toHaveBeenCalled()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Async events.
 | 
					      // Async events.
 | 
				
			||||||
      return eventToPromise(this.col, 'update').then(function (updated) {
 | 
					      return eventToPromise(col, 'update').then(function (updated) {
 | 
				
			||||||
        expect(Object.keys(updated)).toEqual(['bar'])
 | 
					        expect(Object.keys(updated)).toEqual(['bar'])
 | 
				
			||||||
        expect(updated.bar).toBe(1)
 | 
					        expect(updated.bar).toBe(1)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
@@ -192,34 +193,34 @@ describe('Collection', function () {
 | 
				
			|||||||
    it('accepts an object with an id property', function () {
 | 
					    it('accepts an object with an id property', function () {
 | 
				
			||||||
      const foo = { id: 'foo' }
 | 
					      const foo = { id: 'foo' }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.col.set(foo)
 | 
					      col.set(foo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.get(foo.id)).toBe(foo)
 | 
					      expect(col.get(foo.id)).toBe(foo)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('#unset()', function () {
 | 
					  describe('#unset()', function () {
 | 
				
			||||||
    it('removes an existing item', function () {
 | 
					    it('removes an existing item', function () {
 | 
				
			||||||
      this.col.unset('bar')
 | 
					      col.unset('bar')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.has('bar')).toBe(false)
 | 
					      expect(col.has('bar')).toBe(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return eventToPromise(this.col, 'remove').then(function (removed) {
 | 
					      return eventToPromise(col, 'remove').then(function (removed) {
 | 
				
			||||||
        expect(Object.keys(removed)).toEqual(['bar'])
 | 
					        expect(Object.keys(removed)).toEqual(['bar'])
 | 
				
			||||||
        expect(removed.bar).toBeUndefined()
 | 
					        expect(removed.bar).toBeUndefined()
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('does not throw if the item does not exists', function () {
 | 
					    it('does not throw if the item does not exists', function () {
 | 
				
			||||||
      this.col.unset('foo')
 | 
					      col.unset('foo')
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('accepts an object with an id property', function () {
 | 
					    it('accepts an object with an id property', function () {
 | 
				
			||||||
      this.col.unset({id: 'bar'})
 | 
					      col.unset({id: 'bar'})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.has('bar')).toBe(false)
 | 
					      expect(col.has('bar')).toBe(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return eventToPromise(this.col, 'remove').then(function (removed) {
 | 
					      return eventToPromise(col, 'remove').then(function (removed) {
 | 
				
			||||||
        expect(Object.keys(removed)).toEqual(['bar'])
 | 
					        expect(Object.keys(removed)).toEqual(['bar'])
 | 
				
			||||||
        expect(removed.bar).toBeUndefined()
 | 
					        expect(removed.bar).toBeUndefined()
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
@@ -229,12 +230,12 @@ describe('Collection', function () {
 | 
				
			|||||||
  describe('touch()', function () {
 | 
					  describe('touch()', function () {
 | 
				
			||||||
    it('can be used to signal an indirect update', function () {
 | 
					    it('can be used to signal an indirect update', function () {
 | 
				
			||||||
      const foo = { id: 'foo' }
 | 
					      const foo = { id: 'foo' }
 | 
				
			||||||
      this.col.add(foo)
 | 
					      col.add(foo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return waitTicks().then(() => {
 | 
					      return waitTicks().then(() => {
 | 
				
			||||||
        this.col.touch(foo)
 | 
					        col.touch(foo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return eventToPromise(this.col, 'update', (items) => {
 | 
					        return eventToPromise(col, 'update', (items) => {
 | 
				
			||||||
          expect(Object.keys(items)).toEqual(['foo'])
 | 
					          expect(Object.keys(items)).toEqual(['foo'])
 | 
				
			||||||
          expect(items.foo).toBe(foo)
 | 
					          expect(items.foo).toBe(foo)
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
@@ -244,11 +245,11 @@ describe('Collection', function () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  describe('clear()', function () {
 | 
					  describe('clear()', function () {
 | 
				
			||||||
    it('removes all items from the collection', function () {
 | 
					    it('removes all items from the collection', function () {
 | 
				
			||||||
      this.col.clear()
 | 
					      col.clear()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      expect(this.col.size).toBe(0)
 | 
					      expect(col.size).toBe(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return eventToPromise(this.col, 'remove').then((items) => {
 | 
					      return eventToPromise(col, 'remove').then((items) => {
 | 
				
			||||||
        expect(Object.keys(items)).toEqual(['bar'])
 | 
					        expect(Object.keys(items)).toEqual(['bar'])
 | 
				
			||||||
        expect(items.bar).toBeUndefined()
 | 
					        expect(items.bar).toBeUndefined()
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
@@ -314,8 +315,6 @@ describe('Collection', function () {
 | 
				
			|||||||
      ]
 | 
					      ]
 | 
				
			||||||
    }, ([operations, results], label) => {
 | 
					    }, ([operations, results], label) => {
 | 
				
			||||||
      it(label, function () {
 | 
					      it(label, function () {
 | 
				
			||||||
        const {col} = this
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        forEach(operations, ([method, ...args]) => {
 | 
					        forEach(operations, ([method, ...args]) => {
 | 
				
			||||||
          col[method](...args)
 | 
					          col[method](...args)
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -30,7 +30,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.9",
 | 
					    "babel-plugin-lodash": "^3.2.9",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -34,13 +34,13 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.24.1",
 | 
					    "babel-preset-stage-3": "^6.24.1",
 | 
				
			||||||
    "cross-env": "^5.0.1",
 | 
					    "cross-env": "^5.0.1",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "jest": "^20.0.3",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.2"
 | 
					    "standard": "^10.0.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -28,14 +28,14 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.24.1",
 | 
					    "babel-preset-stage-3": "^6.24.1",
 | 
				
			||||||
    "cross-env": "^5.0.1",
 | 
					    "cross-env": "^5.0.1",
 | 
				
			||||||
    "deep-freeze": "^0.0.1",
 | 
					    "deep-freeze": "^0.0.1",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "jest": "^20.0.4",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.2"
 | 
					    "standard": "^10.0.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,4 +0,0 @@
 | 
				
			|||||||
Error.stackTraceLimit = 100
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
try { require('clarify') } catch (_) {}
 | 
					 | 
				
			||||||
try { require('source-map-support/register') } catch (_) {}
 | 
					 | 
				
			||||||
@@ -1 +0,0 @@
 | 
				
			|||||||
--require ./.mocha.js
 | 
					 | 
				
			||||||
@@ -34,26 +34,20 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.15.0",
 | 
					    "babel-plugin-transform-runtime": "^6.15.0",
 | 
				
			||||||
    "babel-preset-latest": "^6.24.1",
 | 
					    "babel-preset-latest": "^6.24.1",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.24.1",
 | 
					    "babel-preset-stage-0": "^6.24.1",
 | 
				
			||||||
    "clarify": "^2.0.0",
 | 
					 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "mocha": "^3.4.2",
 | 
					 | 
				
			||||||
    "must": "^0.13.4",
 | 
					 | 
				
			||||||
    "source-map-support": "^0.4.15",
 | 
					 | 
				
			||||||
    "standard": "^10.0.2"
 | 
					    "standard": "^10.0.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "build": "NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
 | 
					    "build": "NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
 | 
				
			||||||
    "depcheck": "dependency-check ./package.json",
 | 
					    "depcheck": "dependency-check ./package.json",
 | 
				
			||||||
    "dev": "NODE_DEV=development babel --watch --source-maps --out-dir=dist/ src/",
 | 
					    "dev": "NODE_DEV=development babel --watch --source-maps --out-dir=dist/ src/",
 | 
				
			||||||
    "dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
 | 
					 | 
				
			||||||
    "lint": "standard",
 | 
					    "lint": "standard",
 | 
				
			||||||
    "posttest": "yarn run lint && yarn run depcheck",
 | 
					    "posttest": "yarn run lint && yarn run depcheck",
 | 
				
			||||||
    "prepublish": "yarn run build",
 | 
					    "prepublish": "yarn run build"
 | 
				
			||||||
    "test": "mocha --opts .mocha.opts \"dist/**/*.spec.js\""
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "babel": {
 | 
					  "babel": {
 | 
				
			||||||
    "plugins": [
 | 
					    "plugins": [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +0,0 @@
 | 
				
			|||||||
/* eslint-env mocha */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import expect from 'must'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// ===================================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import myLib from './'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// ===================================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
describe.skip('myLib', () => {
 | 
					 | 
				
			||||||
  it('does something', () => {
 | 
					 | 
				
			||||||
    // TODO: some real tests.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    expect(myLib).to.exists()
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -37,14 +37,14 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.1",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-env": "^1.3.3",
 | 
					    "babel-preset-env": "^1.3.3",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.24.1",
 | 
					    "babel-preset-stage-3": "^6.24.1",
 | 
				
			||||||
    "cross-env": "^4.0.0",
 | 
					    "cross-env": "^5.1.1",
 | 
				
			||||||
    "dependency-check": "^2.8.0",
 | 
					    "dependency-check": "^2.8.0",
 | 
				
			||||||
    "jest": "^19.0.2",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.1"
 | 
					    "standard": "^10.0.1"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -34,23 +34,23 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "babel-runtime": "^6.22.0",
 | 
					    "babel-runtime": "^6.22.0",
 | 
				
			||||||
    "event-to-promise": "^0.7.0",
 | 
					    "event-to-promise": "^0.8.0",
 | 
				
			||||||
    "exec-promise": "^0.6.1",
 | 
					    "exec-promise": "^0.7.0",
 | 
				
			||||||
    "inquirer": "^3.0.1",
 | 
					    "inquirer": "^3.0.1",
 | 
				
			||||||
    "ldapjs": "^1.0.1",
 | 
					    "ldapjs": "^1.0.1",
 | 
				
			||||||
    "lodash": "^4.17.4",
 | 
					    "lodash": "^4.17.4",
 | 
				
			||||||
    "promise-toolbox": "^0.8.0"
 | 
					    "promise-toolbox": "^0.9.5"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.24.1",
 | 
					    "babel-preset-stage-3": "^6.24.1",
 | 
				
			||||||
    "cross-env": "^5.0.1",
 | 
					    "cross-env": "^5.0.1",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "jest": "^20.0.4",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.2"
 | 
					    "standard": "^10.0.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -37,7 +37,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-latest": "^6.24.1",
 | 
					    "babel-preset-latest": "^6.24.1",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.24.1",
 | 
					    "babel-preset-stage-0": "^6.24.1",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -41,7 +41,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.10",
 | 
					    "babel-plugin-lodash": "^3.2.10",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.24.1",
 | 
					    "babel-preset-stage-0": "^6.24.1",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -32,13 +32,13 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "babel-runtime": "^6.20.0",
 | 
					    "babel-runtime": "^6.20.0",
 | 
				
			||||||
    "event-to-promise": "^0.7.0",
 | 
					    "event-to-promise": "^0.8.0",
 | 
				
			||||||
    "jsonrpc-websocket-client": "^0.2.0",
 | 
					    "jsonrpc-websocket-client": "^0.2.0",
 | 
				
			||||||
    "superagent": "^3.4.4"
 | 
					    "superagent": "^3.4.4"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.18.0",
 | 
					    "babel-cli": "^6.18.0",
 | 
				
			||||||
    "babel-eslint": "^7.1.1",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.15.0",
 | 
					    "babel-plugin-transform-runtime": "^6.15.0",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.16.0",
 | 
					    "babel-preset-stage-3": "^6.16.0",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -32,12 +32,12 @@
 | 
				
			|||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "babel-runtime": "^6.11.6",
 | 
					    "babel-runtime": "^6.11.6",
 | 
				
			||||||
    "cron": "^1.1.0",
 | 
					    "cron": "^1.1.0",
 | 
				
			||||||
    "event-to-promise": "^0.7.0",
 | 
					    "event-to-promise": "^0.8.0",
 | 
				
			||||||
    "lodash": "^4.16.2"
 | 
					    "lodash": "^4.16.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.9",
 | 
					    "babel-plugin-lodash": "^3.2.9",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-es2015": "^6.24.1",
 | 
					    "babel-preset-es2015": "^6.24.1",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,4 +0,0 @@
 | 
				
			|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 | 
					 | 
				
			||||||
# yarn lockfile v1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -33,17 +33,17 @@
 | 
				
			|||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "nodemailer": "3.1.8",
 | 
					    "nodemailer": "3.1.8",
 | 
				
			||||||
    "nodemailer-markdown": "^1.0.1",
 | 
					    "nodemailer-markdown": "^1.0.1",
 | 
				
			||||||
    "promise-toolbox": "^0.8.2"
 | 
					    "promise-toolbox": "^0.9.5"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.24.1",
 | 
					    "babel-preset-stage-3": "^6.24.1",
 | 
				
			||||||
    "cross-env": "^5.0.1",
 | 
					    "cross-env": "^5.0.1",
 | 
				
			||||||
    "dependency-check": "^2.9.1",
 | 
					    "dependency-check": "^2.9.1",
 | 
				
			||||||
    "jest": "^20.0.4",
 | 
					    "jest": "^21.2.1",
 | 
				
			||||||
    "rimraf": "^2.6.1",
 | 
					    "rimraf": "^2.6.1",
 | 
				
			||||||
    "standard": "^10.0.2"
 | 
					    "standard": "^10.0.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -36,7 +36,7 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
    "babel-preset-stage-3": "^6.24.1",
 | 
					    "babel-preset-stage-3": "^6.24.1",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -32,19 +32,18 @@
 | 
				
			|||||||
    "node": ">=4"
 | 
					    "node": ">=4"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "promise-toolbox": "^0.8.0",
 | 
					    "promise-toolbox": "^0.9.5",
 | 
				
			||||||
    "slack-node": "^0.1.8"
 | 
					    "slack-node": "^0.1.8"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.18.0",
 | 
					    "babel-cli": "^6.18.0",
 | 
				
			||||||
    "babel-eslint": "^7.1.0",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-preset-env": "^1.0.0",
 | 
					    "babel-preset-env": "^1.0.0",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.16.0",
 | 
					    "babel-preset-stage-0": "^6.16.0",
 | 
				
			||||||
    "cross-env": "^3.1.3",
 | 
					    "cross-env": "^5.1.1",
 | 
				
			||||||
    "dependency-check": "^2.6.0",
 | 
					    "dependency-check": "^2.6.0",
 | 
				
			||||||
    "ghooks": "^1.3.2",
 | 
					 | 
				
			||||||
    "rimraf": "^2.5.4",
 | 
					    "rimraf": "^2.5.4",
 | 
				
			||||||
    "standard": "^8.5.0"
 | 
					    "standard": "^10.0.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
 | 
					    "build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import { promisify } from 'promise-toolbox'
 | 
				
			|||||||
// ===================================================================
 | 
					// ===================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const logAndRethrow = error => {
 | 
					const logAndRethrow = error => {
 | 
				
			||||||
  console.error('[WARN] plugin transport-slack:', error && error.stack || error)
 | 
					  console.error('[WARN] plugin transport-slack:', (error != null && error.stack) || error)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  throw error
 | 
					  throw error
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,12 +33,12 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "babel-runtime": "^6.11.6",
 | 
					    "babel-runtime": "^6.11.6",
 | 
				
			||||||
    "event-to-promise": "^0.7.0",
 | 
					    "event-to-promise": "^0.8.0",
 | 
				
			||||||
    "node-xmpp-client": "^3.0.0"
 | 
					    "node-xmpp-client": "^3.0.0"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-latest": "^6.24.1",
 | 
					    "babel-preset-latest": "^6.24.1",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.24.1",
 | 
					    "babel-preset-stage-0": "^6.24.1",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -39,11 +39,11 @@
 | 
				
			|||||||
    "handlebars": "^4.0.6",
 | 
					    "handlebars": "^4.0.6",
 | 
				
			||||||
    "html-minifier": "^3.4.0",
 | 
					    "html-minifier": "^3.4.0",
 | 
				
			||||||
    "lodash": "^4.17.4",
 | 
					    "lodash": "^4.17.4",
 | 
				
			||||||
    "promise-toolbox": "^0.8.0"
 | 
					    "promise-toolbox": "^0.9.5"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.24.1",
 | 
					    "babel-cli": "^6.24.1",
 | 
				
			||||||
    "babel-eslint": "^7.2.3",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-lodash": "^3.2.11",
 | 
					    "babel-plugin-lodash": "^3.2.11",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.23.0",
 | 
					    "babel-plugin-transform-runtime": "^6.23.0",
 | 
				
			||||||
    "babel-preset-env": "^1.5.2",
 | 
					    "babel-preset-env": "^1.5.2",
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -31,17 +31,16 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-cli": "^6.18.0",
 | 
					    "babel-cli": "^6.18.0",
 | 
				
			||||||
    "babel-eslint": "^7.1.0",
 | 
					    "babel-eslint": "^8.0.1",
 | 
				
			||||||
    "babel-plugin-transform-runtime": "^6.15.0",
 | 
					    "babel-plugin-transform-runtime": "^6.15.0",
 | 
				
			||||||
    "babel-preset-env": "^1.0.0",
 | 
					    "babel-preset-env": "^1.0.0",
 | 
				
			||||||
    "babel-preset-stage-0": "^6.16.0",
 | 
					    "babel-preset-stage-0": "^6.16.0",
 | 
				
			||||||
    "cross-env": "^3.1.3",
 | 
					    "cross-env": "^5.1.1",
 | 
				
			||||||
    "dependency-check": "^2.6.0",
 | 
					    "dependency-check": "^2.6.0",
 | 
				
			||||||
    "ghooks": "^1.3.2",
 | 
					    "mocha": "^4.0.1",
 | 
				
			||||||
    "mocha": "^3.1.2",
 | 
					 | 
				
			||||||
    "must": "^0.13.2",
 | 
					    "must": "^0.13.2",
 | 
				
			||||||
    "rimraf": "^2.5.4",
 | 
					    "rimraf": "^2.5.4",
 | 
				
			||||||
    "standard": "^8.5.0"
 | 
					    "standard": "^10.0.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
 | 
					    "build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
 | 
				
			||||||
@@ -54,7 +53,7 @@
 | 
				
			|||||||
    "prebuild": "npm run clean",
 | 
					    "prebuild": "npm run clean",
 | 
				
			||||||
    "predev": "npm run clean",
 | 
					    "predev": "npm run clean",
 | 
				
			||||||
    "prepublish": "npm run build",
 | 
					    "prepublish": "npm run build",
 | 
				
			||||||
    "test": "mocha \"dist/**/*.spec.js\""
 | 
					    "test-disabled": "mocha \"dist/**/*.spec.js\""
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "babel": {
 | 
					  "babel": {
 | 
				
			||||||
    "plugins": [
 | 
					    "plugins": [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,7 @@ class Block {
 | 
				
			|||||||
  constructor (blockSize) {
 | 
					  constructor (blockSize) {
 | 
				
			||||||
    const bitmapSize = blockSize / sectorSize / 8
 | 
					    const bitmapSize = blockSize / sectorSize / 8
 | 
				
			||||||
    const bufferSize = Math.ceil((blockSize + bitmapSize) / sectorSize) * sectorSize
 | 
					    const bufferSize = Math.ceil((blockSize + bitmapSize) / sectorSize) * sectorSize
 | 
				
			||||||
    this.buffer = new Buffer(bufferSize)
 | 
					    this.buffer = Buffer.alloc(bufferSize)
 | 
				
			||||||
    this.buffer.fill(0)
 | 
					 | 
				
			||||||
    this.bitmapBuffer = this.buffer.slice(0, bitmapSize)
 | 
					    this.bitmapBuffer = this.buffer.slice(0, bitmapSize)
 | 
				
			||||||
    this.dataBuffer = this.buffer.slice(bitmapSize)
 | 
					    this.dataBuffer = this.buffer.slice(bitmapSize)
 | 
				
			||||||
    this.bitmapBuffer.fill(0xff)
 | 
					    this.bitmapBuffer.fill(0xff)
 | 
				
			||||||
@@ -161,16 +160,15 @@ export function computeGeometryForSize (size) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function createFooter (size, timestamp, geometry, diskType, dataOffsetLow = 0xFFFFFFFF, dataOffsetHigh = 0xFFFFFFFF) {
 | 
					export function createFooter (size, timestamp, geometry, diskType, dataOffsetLow = 0xFFFFFFFF, dataOffsetHigh = 0xFFFFFFFF) {
 | 
				
			||||||
  let footer = new Buffer(512)
 | 
					  let footer = Buffer.alloc(512)
 | 
				
			||||||
  footer.fill(0)
 | 
					  Buffer.from(footerCookie, 'ascii').copy(footer)
 | 
				
			||||||
  new Buffer(footerCookie, 'ascii').copy(footer)
 | 
					 | 
				
			||||||
  footer.writeUInt32BE(2, 8)
 | 
					  footer.writeUInt32BE(2, 8)
 | 
				
			||||||
  footer.writeUInt32BE(0x00010000, 12)
 | 
					  footer.writeUInt32BE(0x00010000, 12)
 | 
				
			||||||
  footer.writeUInt32BE(dataOffsetHigh, 16)
 | 
					  footer.writeUInt32BE(dataOffsetHigh, 16)
 | 
				
			||||||
  footer.writeUInt32BE(dataOffsetLow, 20)
 | 
					  footer.writeUInt32BE(dataOffsetLow, 20)
 | 
				
			||||||
  footer.writeUInt32BE(timestamp, 24)
 | 
					  footer.writeUInt32BE(timestamp, 24)
 | 
				
			||||||
  new Buffer(creatorApp, 'ascii').copy(footer, 28)
 | 
					  Buffer.from(creatorApp, 'ascii').copy(footer, 28)
 | 
				
			||||||
  new Buffer(osString, 'ascii').copy(footer, 36)
 | 
					  Buffer.from(osString, 'ascii').copy(footer, 36)
 | 
				
			||||||
  // do not use & 0xFFFFFFFF to extract lower bits, that would propagate a negative sign if the 2^31 bit is one
 | 
					  // do not use & 0xFFFFFFFF to extract lower bits, that would propagate a negative sign if the 2^31 bit is one
 | 
				
			||||||
  const sizeHigh = Math.floor(size / Math.pow(2, 32)) % Math.pow(2, 32)
 | 
					  const sizeHigh = Math.floor(size / Math.pow(2, 32)) % Math.pow(2, 32)
 | 
				
			||||||
  const sizeLow = size % Math.pow(2, 32)
 | 
					  const sizeLow = size % Math.pow(2, 32)
 | 
				
			||||||
@@ -188,9 +186,8 @@ export function createFooter (size, timestamp, geometry, diskType, dataOffsetLow
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function createDynamicDiskHeader (tableEntries, blockSize) {
 | 
					export function createDynamicDiskHeader (tableEntries, blockSize) {
 | 
				
			||||||
  let header = new Buffer(1024)
 | 
					  let header = Buffer.alloc(1024)
 | 
				
			||||||
  header.fill(0)
 | 
					  Buffer.from(headerCookie, 'ascii').copy(header)
 | 
				
			||||||
  new Buffer(headerCookie, 'ascii').copy(header)
 | 
					 | 
				
			||||||
  // hard code no next data
 | 
					  // hard code no next data
 | 
				
			||||||
  header.writeUInt32BE(0xFFFFFFFF, 8)
 | 
					  header.writeUInt32BE(0xFFFFFFFF, 8)
 | 
				
			||||||
  header.writeUInt32BE(0xFFFFFFFF, 12)
 | 
					  header.writeUInt32BE(0xFFFFFFFF, 12)
 | 
				
			||||||
@@ -208,8 +205,7 @@ export function createDynamicDiskHeader (tableEntries, blockSize) {
 | 
				
			|||||||
export function createEmptyTable (dataSize, blockSize) {
 | 
					export function createEmptyTable (dataSize, blockSize) {
 | 
				
			||||||
  const blockCount = Math.ceil(dataSize / blockSize)
 | 
					  const blockCount = Math.ceil(dataSize / blockSize)
 | 
				
			||||||
  const tableSizeSectors = Math.ceil(blockCount * 4 / sectorSize)
 | 
					  const tableSizeSectors = Math.ceil(blockCount * 4 / sectorSize)
 | 
				
			||||||
  const buffer = new Buffer(tableSizeSectors * sectorSize)
 | 
					  const buffer = Buffer.alloc(tableSizeSectors * sectorSize, 0xff)
 | 
				
			||||||
  buffer.fill(0xff)
 | 
					 | 
				
			||||||
  return {entryCount: blockCount, buffer: buffer, entries: []}
 | 
					  return {entryCount: blockCount, buffer: buffer, entries: []}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -232,14 +228,12 @@ export class ReadableRawVHDStream extends stream.Readable {
 | 
				
			|||||||
      const chunkCount = Math.floor(paddingLength / chunkSize)
 | 
					      const chunkCount = Math.floor(paddingLength / chunkSize)
 | 
				
			||||||
      for (let i = 0; i < chunkCount; i++) {
 | 
					      for (let i = 0; i < chunkCount; i++) {
 | 
				
			||||||
        this.currentFile.push(() => {
 | 
					        this.currentFile.push(() => {
 | 
				
			||||||
          const paddingBuffer = new Buffer(chunkSize)
 | 
					          const paddingBuffer = Buffer.alloc(chunkSize)
 | 
				
			||||||
          paddingBuffer.fill(0)
 | 
					 | 
				
			||||||
          return paddingBuffer
 | 
					          return paddingBuffer
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      this.currentFile.push(() => {
 | 
					      this.currentFile.push(() => {
 | 
				
			||||||
        const paddingBuffer = new Buffer(paddingLength % chunkSize)
 | 
					        const paddingBuffer = Buffer.alloc(paddingLength % chunkSize)
 | 
				
			||||||
        paddingBuffer.fill(0)
 | 
					 | 
				
			||||||
        return paddingBuffer
 | 
					        return paddingBuffer
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,8 +22,8 @@ describe('VHD writing', () => {
 | 
				
			|||||||
    const expectedChecksum1 = 0xFFFFEFB2
 | 
					    const expectedChecksum1 = 0xFFFFEFB2
 | 
				
			||||||
    const testValue2 = '6378737061727365FFFFFFFFFFFFFFFF0000000000000600000100000000000100200000'
 | 
					    const testValue2 = '6378737061727365FFFFFFFFFFFFFFFF0000000000000600000100000000000100200000'
 | 
				
			||||||
    const expectedChecksum2 = 0xFFFFF476
 | 
					    const expectedChecksum2 = 0xFFFFF476
 | 
				
			||||||
    expect(computeChecksum(new Buffer(testValue1, 'hex'))).to.equal(expectedChecksum1)
 | 
					    expect(computeChecksum(Buffer.from(testValue1, 'hex'))).to.equal(expectedChecksum1)
 | 
				
			||||||
    expect(computeChecksum(new Buffer(testValue2, 'hex'))).to.equal(expectedChecksum2)
 | 
					    expect(computeChecksum(Buffer.from(testValue2, 'hex'))).to.equal(expectedChecksum2)
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('createFooter() does not crash', () => {
 | 
					  it('createFooter() does not crash', () => {
 | 
				
			||||||
@@ -37,10 +37,10 @@ describe('VHD writing', () => {
 | 
				
			|||||||
  it('ReadableRawVHDStream does not crash', () => {
 | 
					  it('ReadableRawVHDStream does not crash', () => {
 | 
				
			||||||
    const data = [{
 | 
					    const data = [{
 | 
				
			||||||
      lbaBytes: 100,
 | 
					      lbaBytes: 100,
 | 
				
			||||||
      grain: new Buffer('azerzaerazeraze', 'ascii')
 | 
					      grain: Buffer.from('azerzaerazeraze', 'ascii')
 | 
				
			||||||
    }, {
 | 
					    }, {
 | 
				
			||||||
      lbaBytes: 700,
 | 
					      lbaBytes: 700,
 | 
				
			||||||
      grain: new Buffer('gdfslkdfguer', 'ascii')
 | 
					      grain: Buffer.from('gdfslkdfguer', 'ascii')
 | 
				
			||||||
    }]
 | 
					    }]
 | 
				
			||||||
    let index = 0
 | 
					    let index = 0
 | 
				
			||||||
    const mockParser = {
 | 
					    const mockParser = {
 | 
				
			||||||
@@ -65,10 +65,10 @@ describe('VHD writing', () => {
 | 
				
			|||||||
  it('ReadableRawVHDStream detects when blocks are out of order', () => {
 | 
					  it('ReadableRawVHDStream detects when blocks are out of order', () => {
 | 
				
			||||||
    const data = [{
 | 
					    const data = [{
 | 
				
			||||||
      lbaBytes: 700,
 | 
					      lbaBytes: 700,
 | 
				
			||||||
      grain: new Buffer('azerzaerazeraze', 'ascii')
 | 
					      grain: Buffer.from('azerzaerazeraze', 'ascii')
 | 
				
			||||||
    }, {
 | 
					    }, {
 | 
				
			||||||
      lbaBytes: 100,
 | 
					      lbaBytes: 100,
 | 
				
			||||||
      grain: new Buffer('gdfslkdfguer', 'ascii')
 | 
					      grain: Buffer.from('gdfslkdfguer', 'ascii')
 | 
				
			||||||
    }]
 | 
					    }]
 | 
				
			||||||
    let index = 0
 | 
					    let index = 0
 | 
				
			||||||
    const mockParser = {
 | 
					    const mockParser = {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ function parseU64b (buffer, offset, valueName) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function parseDescriptor (descriptorSlice) {
 | 
					function parseDescriptor (descriptorSlice) {
 | 
				
			||||||
  const descriptorText = descriptorSlice.toString('ascii').replace(/\x00+$/, '')
 | 
					  const descriptorText = descriptorSlice.toString('ascii').replace(/\x00+$/, '') // eslint-disable-line no-control-regex
 | 
				
			||||||
  const descriptorDict = {}
 | 
					  const descriptorDict = {}
 | 
				
			||||||
  const extentList = []
 | 
					  const extentList = []
 | 
				
			||||||
  const lines = descriptorText.split(/\r?\n/).filter((line) => {
 | 
					  const lines = descriptorText.split(/\r?\n/).filter((line) => {
 | 
				
			||||||
@@ -258,8 +258,7 @@ export async function readRawContent (readStream) {
 | 
				
			|||||||
  if (header.grainDirectoryOffsetSectors === -1) {
 | 
					  if (header.grainDirectoryOffsetSectors === -1) {
 | 
				
			||||||
    header = parseHeader(buffer.slice(-1024, -1024 + sectorSize))
 | 
					    header = parseHeader(buffer.slice(-1024, -1024 + sectorSize))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  const rawOutputBuffer = new Buffer(header.capacitySectors * sectorSize)
 | 
					  const rawOutputBuffer = Buffer.alloc(header.capacitySectors * sectorSize)
 | 
				
			||||||
  rawOutputBuffer.fill(0)
 | 
					 | 
				
			||||||
  const l1Size = Math.floor((header.capacitySectors + header.l1EntrySectors - 1) / header.l1EntrySectors)
 | 
					  const l1Size = Math.floor((header.capacitySectors + header.l1EntrySectors - 1) / header.l1EntrySectors)
 | 
				
			||||||
  const l2Size = header.numGTEsPerGT
 | 
					  const l2Size = header.numGTEsPerGT
 | 
				
			||||||
  const l1 = []
 | 
					  const l1 = []
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,43 +1,32 @@
 | 
				
			|||||||
#!/usr/bin/env node
 | 
					#!/usr/bin/env node
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const PKGS_DIR = `${__dirname}/../packages`
 | 
					const { getPackages, writeFile, unlink } = require('./utils')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { fromCallback } = require('promise-toolbox')
 | 
					require('exec-promise')(() =>
 | 
				
			||||||
const { readdir, readFile, unlink, writeFile } = require('fs')
 | 
					  getPackages(true).map(({ dir, name, package: pkg }) => {
 | 
				
			||||||
 | 
					    pkg.name = name
 | 
				
			||||||
const pUnlink = path => fromCallback(cb =>
 | 
					    pkg.homepage = `https://github.com/vatesfr/xen-orchestra/tree/master/packages/${name}`
 | 
				
			||||||
  unlink(path, cb)
 | 
					    pkg.bugs = `https://github.com/vatesfr/xo-web/issues`
 | 
				
			||||||
).catch(error => {
 | 
					    pkg.repository = {
 | 
				
			||||||
  if (error.code !== 'ENOENT') {
 | 
					 | 
				
			||||||
    throw error
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const normalizePackage = name => Promise.all([
 | 
					 | 
				
			||||||
  fromCallback(cb =>
 | 
					 | 
				
			||||||
    readFile(`${PKGS_DIR}/${name}/package.json`, cb)
 | 
					 | 
				
			||||||
  ).then(JSON.parse).then(package => {
 | 
					 | 
				
			||||||
    package.name = name
 | 
					 | 
				
			||||||
    package.homepage = `https://github.com/vatesfr/xen-orchestra/tree/master/packages/${name}`
 | 
					 | 
				
			||||||
    package.bugs = `https://github.com/vatesfr/xo-web/issues`
 | 
					 | 
				
			||||||
    package.repository = {
 | 
					 | 
				
			||||||
      type: 'git',
 | 
					      type: 'git',
 | 
				
			||||||
      url: 'https://github.com/vatesfr/xen-orchestra.git'
 | 
					      url: 'https://github.com/vatesfr/xen-orchestra.git'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return fromCallback(cb => writeFile(
 | 
					    const { devDependencies } = pkg
 | 
				
			||||||
      `${PKGS_DIR}/${name}/package.json`,
 | 
					    if (devDependencies !== undefined) {
 | 
				
			||||||
      JSON.stringify(package, null, 2) + '\n',
 | 
					      delete devDependencies.ghooks
 | 
				
			||||||
      cb
 | 
					      delete devDependencies.husky
 | 
				
			||||||
    ))
 | 
					    }
 | 
				
			||||||
  }),
 | 
					 | 
				
			||||||
  pUnlink(`${PKGS_DIR}/${name}/.editorconfig`),
 | 
					 | 
				
			||||||
  pUnlink(`${PKGS_DIR}/${name}/.gitignore`)
 | 
					 | 
				
			||||||
])
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const main =() => fromCallback(cb =>
 | 
					    return Promise.all([
 | 
				
			||||||
  readdir(PKGS_DIR, cb)
 | 
					      writeFile(
 | 
				
			||||||
).then(pkgs => Promise.all(pkgs.map(pkg =>
 | 
					        `${dir}/package.json`,
 | 
				
			||||||
  normalizePackage(pkg)
 | 
					        JSON.stringify(pkg, null, 2) + '\n'
 | 
				
			||||||
)))
 | 
					      ),
 | 
				
			||||||
main().catch(console.error)
 | 
					      unlink(`${dir}/.editorconfig`),
 | 
				
			||||||
 | 
					      unlink(`${dir}/.gitignore`),
 | 
				
			||||||
 | 
					      unlink(`${dir}/.jshintrc`),
 | 
				
			||||||
 | 
					      unlink(`${dir}/yarn.lock`)
 | 
				
			||||||
 | 
					    ])
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										20
									
								
								scripts/run
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								scripts/run
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env node
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { fromEvent } = require('promise-toolbox')
 | 
				
			||||||
 | 
					const { spawn } = require('child_process')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { getPackages } = require('./utils')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require('exec-promise')(([ command, ...args ]) =>
 | 
				
			||||||
 | 
					  getPackages().forEach(({ dir, name }) => {
 | 
				
			||||||
 | 
					    console.log('*', name)
 | 
				
			||||||
 | 
					    return fromEvent(spawn(command, args, {
 | 
				
			||||||
 | 
					      cwd: dir,
 | 
				
			||||||
 | 
					      stdio: 'inherit'
 | 
				
			||||||
 | 
					    }), 'exit').then(code => {
 | 
				
			||||||
 | 
					      if (code !== 0) {
 | 
				
			||||||
 | 
					        throw code
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
							
								
								
									
										43
									
								
								scripts/run-script
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										43
									
								
								scripts/run-script
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env node
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { delimiter } = require('path')
 | 
				
			||||||
 | 
					const { forEach, fromEvent } = require('promise-toolbox')
 | 
				
			||||||
 | 
					const { spawn } = require('child_process')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { getPackages } = require('./utils')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { env } = process
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// run a script for each package (also run pre and post)
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// TODO: https://docs.npmjs.com/misc/scripts#environment
 | 
				
			||||||
 | 
					require('exec-promise')(([ script ]) =>
 | 
				
			||||||
 | 
					  getPackages(true).forEach(({ dir, name, package: { scripts } }) => {
 | 
				
			||||||
 | 
					    if (scripts == null) {
 | 
				
			||||||
 | 
					      return
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const spawnOpts = {
 | 
				
			||||||
 | 
					      cwd: dir,
 | 
				
			||||||
 | 
					      env: Object.assign({}, env, {
 | 
				
			||||||
 | 
					        PATH: `${dir}/node_modules/.bin${delimiter}${env.PATH}`
 | 
				
			||||||
 | 
					      }),
 | 
				
			||||||
 | 
					      shell: true,
 | 
				
			||||||
 | 
					      stdio: 'inherit'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return forEach.call(
 | 
				
			||||||
 | 
					      [ `pre${script}`, script, `post${script}` ],
 | 
				
			||||||
 | 
					      script => {
 | 
				
			||||||
 | 
					        const command = scripts[script]
 | 
				
			||||||
 | 
					        if (command !== undefined) {
 | 
				
			||||||
 | 
					          console.log(`* ${name}:${script}`)
 | 
				
			||||||
 | 
					          return fromEvent(spawn(command, spawnOpts), 'exit').then(code => {
 | 
				
			||||||
 | 
					            if (code !== 0) {
 | 
				
			||||||
 | 
					              throw code
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
							
								
								
									
										44
									
								
								scripts/utils.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								scripts/utils.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					const { forEach, fromCallback } = require('promise-toolbox')
 | 
				
			||||||
 | 
					const fs = require('fs')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const PKGS_DIR = `${__dirname}/../packages`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exports.getPackages = (readPackageJson = false) => {
 | 
				
			||||||
 | 
					  const p = fromCallback(cb =>
 | 
				
			||||||
 | 
					    fs.readdir(PKGS_DIR, cb)
 | 
				
			||||||
 | 
					  ).then(names => {
 | 
				
			||||||
 | 
					    const pkgs = names.map(name => ({
 | 
				
			||||||
 | 
					      dir: `${PKGS_DIR}/${name}`,
 | 
				
			||||||
 | 
					      name
 | 
				
			||||||
 | 
					    }))
 | 
				
			||||||
 | 
					    return readPackageJson
 | 
				
			||||||
 | 
					      ? Promise.all(pkgs.map(pkg =>
 | 
				
			||||||
 | 
					        readFile(`${pkg.dir}/package.json`).then(data => {
 | 
				
			||||||
 | 
					          pkg.package = JSON.parse(data)
 | 
				
			||||||
 | 
					          return pkg
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					      ))
 | 
				
			||||||
 | 
					      : pkgs
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					  p.forEach = fn => p.then(pkgs => forEach.call(pkgs, fn))
 | 
				
			||||||
 | 
					  p.map = fn => p.then(pkgs => Promise.all(pkgs.map(fn))).then(noop)
 | 
				
			||||||
 | 
					  return p
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const noop = exports.noop = () => {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const readFile = exports.readFile = file => fromCallback(cb =>
 | 
				
			||||||
 | 
					  fs.readFile(file, 'utf8', cb)
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exports.unlink = path => fromCallback(cb =>
 | 
				
			||||||
 | 
					  fs.unlink(path, cb)
 | 
				
			||||||
 | 
					).catch(error => {
 | 
				
			||||||
 | 
					  if (error.code !== 'ENOENT') {
 | 
				
			||||||
 | 
					    throw error
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exports.writeFile = (file, data) => fromCallback(cb =>
 | 
				
			||||||
 | 
					  fs.writeFile(file, data, cb)
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user