UNPKG

531 BJavaScriptView Raw
1var N = require('libnested')
2
3function isFunction (f) {
4 return typeof f === 'function'
5}
6
7function isTrue (b) {
8 return b === true
9}
10
11function isGives (o) {
12 return isString(o) || N.each(o, isTrue)
13}
14
15function isType (t) {
16 return ({map: true, first: true, reduce: true})[t]
17}
18
19function isNeeds (n) {
20 return N.each(n, isType)
21}
22
23function isModule (m) {
24 return isFunction(m.create) && isGives(m.gives) && (!m.needs || isNeeds(m.needs))
25}
26
27function isString (s) {
28 return typeof s === 'string'
29}
30
31module.exports = isModule