Skip to content

Commit 45b4a4a

Browse files
committed
Switch to mout for utility functions
1 parent bd406fa commit 45b4a4a

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

lib/bundle.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use strict';
22

3-
var typeOf = require('prime/type'),
4-
forOwn = require('prime/object/forOwn'),
5-
indexOf = require('prime/array/indexOf'),
3+
var isObject = require('mout/lang/isObject'),
4+
isString = require('mout/lang/isString'),
5+
forOwn = require('mout/object/forOwn'),
6+
indexOf = require('mout/array/indexOf'),
67
hash = require('./hash'),
78
db = require('./db');
89

@@ -22,21 +23,21 @@ var Bundle = function(raw){
2223
return new Bundle(raw);
2324
}
2425

25-
if (typeOf(raw) !== 'object'){
26+
if (!isObject(raw)){
2627
throw new Error('No raw data provided');
2728
}
28-
if (!raw.code || typeOf(raw.code) != 'object'){
29+
if (!raw.code || !isObject(raw.code)){
2930
throw new Error('No code found');
3031
}
3132

3233
var type, mode, body;
3334
this.data = {};
3435
forOwn(types, function(modes, t){
35-
if (typeOf(raw.code[t]) != 'object') return;
36+
if (!isObject(raw.code[t])) return;
3637

3738
type = raw.code[t];
38-
mode = typeOf(type.mode) == 'string' && indexOf(modes, type.mode) > -1;
39-
body = typeOf(type.body) == 'string' && type.body !== '';
39+
mode = isString(type.mode) && indexOf(modes, type.mode) > -1;
40+
body = isString(type.body) && type.body !== '';
4041
if (mode && body){
4142
if (!this.data.code) this.data.code = {};
4243

lib/hash.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var typeOf = require('prime/type');
3+
var isFunction = require('mout/lang/isFunction');
44

55
var BASE62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
66

@@ -25,7 +25,7 @@ var generate = function(length){
2525
* @param {Function} cb
2626
*/
2727
var unique = function(coll, length, cb){
28-
if (typeOf(length) == 'function'){
28+
if (isFunction(length)){
2929
cb = length;
3030
length = null;
3131
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"main": "app.js",
1111
"dependencies": {
1212
"express": "3.4",
13-
"prime": "0.3",
13+
"mout": "0.8",
1414
"mongodb": "1.3"
1515
}
1616
}

0 commit comments

Comments
 (0)