<repo_name>arian/underprime<file_sep>/list/compact.js
"use strict";

var list = require('prime/collection/list')

list.implement({
    compact: function(){
        return list.filter(this, function(value){
            return !!value;
        })
    }
})

require('../').implement('compact', list)
module.exports = list.compact
<file_sep>/list/pluck.js
"use strict";

var list = require('prime/collection/list')

list.implement({
    pluck: function(key){
        return list.map(this, function(value){
            return value[key]
        })
    }
})

require('../').implement('pluck', list)
module.exports = list.pluck
<file_sep>/list/flatten.js
"use strict";

var array = require('prime/es5/array')
var list = require('prime/collection/list')

var flatten = function(input, shallow, output){
    list.forEach(input, function(value){
        if (array.isArray(value)){
            if (shallow){
                output.push.apply(output, value)
            } else {
                flatten(value, shallow, output)
            }
        } else {
            output.push(value)
        }
    })
    return output
}

list.implement({
    flatten: function(shallow) {
        return flatten(this, shallow, [])
    }
})

require('../').implement('flatten', list)
module.exports = list.flatten
<file_sep>/list/first.js
"use strict";

var list = require('prime/collection/list')

list.implement({
    first: function(n){
        return (n != null) ? this.slice(0, n) : this[0]
    }
})

require('../').implement('first', list)
module.exports = list.first
