Skip to content

Commit

Permalink
remove Promise polyfill
Browse files Browse the repository at this point in the history
breaking change
  • Loading branch information
shinnn committed Jul 1, 2015
1 parent 44d85f3 commit 7b06a93
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 1 addition & 3 deletions index.js
Expand Up @@ -2,10 +2,8 @@
* read-glob-promise | MIT (c) Shinnosuke Watanabe
* https://github.com/shinnn/read-glob-promise
*/

'use strict';

var ES6Promise = global.Promise || require('es6-promise').Promise;
var readYaml = require('read-yaml');

module.exports = function readYamlPromise(filePath, options) {
Expand All @@ -20,7 +18,7 @@ module.exports = function readYamlPromise(filePath, options) {
resolve(data);
});

return new ES6Promise(function(_resolve, _reject) {
return new Promise(function(_resolve, _reject) {
resolve = _resolve;
reject = _reject;
});
Expand Down
4 changes: 1 addition & 3 deletions package.json
Expand Up @@ -12,8 +12,7 @@
},
"license": "MIT",
"files": [
"index.js",
"LICENSE"
"index.js"
],
"keywords": [
"yml",
Expand All @@ -28,7 +27,6 @@
"thenable"
],
"dependencies": {
"es6-promise": "^2.0.1",
"read-yaml": "^1.0.0"
},
"devDependencies": {
Expand Down
14 changes: 9 additions & 5 deletions test/test.js
@@ -1,6 +1,6 @@
'use strict';

var readYaml = require('../');
var readYaml = require('..');
var test = require('tape');
var yaml = require('js-yaml');

Expand Down Expand Up @@ -31,22 +31,26 @@ test('readYamlPromise()', function(t) {
});

t.throws(
readYaml.bind(null, 'test/fixture.yaml', 1), /TypeError.*arg/,
readYaml.bind(null, 'test/fixture.yaml', 1),
/TypeError/,
'should throw a type error when the second argument is not a string or an object.'
);

t.throws(
readYaml.bind(null, 'test/fixture.yaml', 'utf7'), /Error.*encoding/,
readYaml.bind(null, 'test/fixture.yaml', 'utf7'),
/Error.*encoding/,
'should throw an error when the encoding is unknown.'
);

t.throws(
readYaml.bind(null, true, ['foo']), /TypeError.*path/,
readYaml.bind(null, true, ['foo']),
/TypeError.*path/,
'should throw a type error when the first argument is not a string.'
);

t.throws(
readYaml.bind(null), /TypeError.*path/,
readYaml.bind(null),
/TypeError.*path/,
'should throw a type error when it takes no arguments.'
);
});

0 comments on commit 7b06a93

Please sign in to comment.