<commit_before>// Copyright 2012 Joyent, Inc.  All rights reserved.

var assert = require('assert');
var util = require('util');

var restify = require('restify');



// --- Globals

var ResourceNotFoundError = restify.ResourceNotFoundError;



// --- Helpers

function translate(pkg) {
    assert.ok(pkg);

    return {
        urn: pkg.urn,
        name: pkg.name,
        memory: pkg.max_physical_memory,
        disk: pkg.quota,
        vcpus: pkg.vcpus,
        swap: pkg.max_swap,
        'default': pkg['default'] || false
    };
}



// --- Functions

function load(req, res, next) {
    assert.ok(req.account);
    assert.ok(req.sdc.pkg);

    var customer = req.account.uuid,
        log = req.log;

    req.pkg = false;

    return req.sdc.pkg.list(function (err, packages) {
        console.log(util.inspect(packages, false, 8));
        if (err) {
            return next(err);
        }

        req.packages = packages || [];
        var pkg,
           _p = req.params['package'];
        if (_p) {
            pkg = req.packages.filter(function (p) {
                if (_p === p.urn || _p === p.name) {
                    return p;
                }

                return undefined;
            });
        } else {
            pkg = req.packages.filter(function (p) {
                if (p['default'] === true) {<commit_msg>Lint cleanup<commit_after>// Copyright 2012 Joyent, Inc.  All rights reserved.

var assert = require('assert');
var util = require('util');

var restify = require('restify');



// --- Globals

var ResourceNotFoundError = restify.ResourceNotFoundError;



// --- Helpers

function translate(pkg) {
    assert.ok(pkg);

    return {
        urn: pkg.urn,
        name: pkg.name,
        memory: pkg.max_physical_memory,
        disk: pkg.quota,
        vcpus: pkg.vcpus,
        swap: pkg.max_swap,
        'default': pkg['default'] || false
    };
}



// --- Functions

function load(req, res, next) {
    assert.ok(req.account);
    assert.ok(req.sdc.pkg);

    var log = req.log;

    req.pkg = false;

    return req.sdc.pkg.list(function (err, packages) {
        console.log(util.inspect(packages, false, 8));
        if (err) {
            return next(err);
        }

        req.packages = packages || [];
        var pkg,
           _p = req.params['package'];
        if (_p) {
            pkg = req.packages.filter(function (p) {
                if (_p === p.urn || _p === p.name) {
                    return p;
                }

                return undefined;
            });
        } else {
            pkg = req.packages.filter(function (p) {
                if (p['default'] === true) {
{'fraction_non_alphanumeric': 0.14544084400904295, 'fraction_numerical': 0.0037678975131876413, 'mean_word_length': 1.6954314720812182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4177145', 'n_tokens_mistral': 869, 'n_tokens_neox': 802, 'n_words': 185}