Skip to content

Commit 4c3027f

Browse files
committed
Remove explicit util dependency.
`assert` depended on the userland `util` module rather than browserify's builtin, which could cause two different versions of `util` could be included in bundles, if browserify's version doesn't exactly match `assert`'s dependency. Since `util` is builtin in Node and in bundlers, we can safely use it instead of explicitly depending on it.
1 parent 3d981b5 commit 4c3027f

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function isBuffer(b) {
6868
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
6969
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7070

71-
var util = require('util/');
71+
var util = require('util');
7272
var hasOwn = Object.prototype.hasOwnProperty;
7373
var pSlice = Array.prototype.slice;
7474
var functionsHaveNames = (function () {

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
"url": "git://github.com/defunctzombie/commonjs-assert.git"
1313
},
1414
"main": "./assert.js",
15-
"dependencies": {
16-
"util": "0.10.3"
17-
},
1815
"devDependencies": {
1916
"mocha": "~1.21.4",
2017
"zuul": "~3.10.0",

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ function tests (assert, what) {
307307
testAssertionMessage(new Buffer([1, 2, 3]), '<Buffer 01 02 03>');
308308
if (typeof global.Uint8Array === 'function' && Object.getOwnPropertyNames( new Uint8Array([])).length === 0) {
309309
// todo fix util.inspect
310-
testAssertionMessage(new Uint8Array([1, 2, 3]), '{ \'0\': 1, \'1\': 2, \'2\': 3 }');
310+
testAssertionMessage(new Uint8Array([1, 2, 3]), 'Uint8Array [ 1, 2, 3 ]');
311311
}
312312
testAssertionMessage(/a/, '/a/');
313313
testAssertionMessage(function f() {}, '[Function: f]');

0 commit comments

Comments
 (0)