<commit_before>'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace dist
*/
var dist = {};

/**
* @name beta
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/beta}
*/
setReadOnly( dist, 'beta', require( '@stdlib/math/base/dist/beta' ) );

/**
* @name binomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/binomial}
*/
setReadOnly( dist, 'binomial', require( '@stdlib/math/base/dist/binomial' ) );

/**
* @name cauchy
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/cauchy}
*/
setReadOnly( dist, 'cauchy', require( '@stdlib/math/base/dist/cauchy' ) );

/**
* @name chisquare
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/chisquare}
*/
setReadOnly( dist, 'chisquare', require( '@stdlib/math/base/dist/chisquare' ) );

/**
* @name degenerate
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/degenerate}
*/
setReadOnly( dist, 'degenerate', require( '@stdlib/math/base/dist/degenerate' ) );

/**
* @name erlang
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/erlang}
*/
setReadOnly( dist, 'erlang', require( '@stdlib/math/base/dist/erlang' ) );

/**
* @name exponential
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/exponential}
*/
setReadOnly( dist, 'exponential', require( '@stdlib/math/base/dist/exponential' ) );

/**
* @name f
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/f}
*/
setReadOnly( dist, 'f', require( '@stdlib/math/base/dist/f' ) );

/**
* @name gamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gamma}
*/
setReadOnly( dist, 'gamma', require( '@stdlib/math/base/dist/gamma' ) );

/**
* @name geometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/geometric}
*/
setReadOnly( dist, 'geometric', require( '@stdlib/math/base/dist/geometric' ) );

/**
* @name gumbel
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gumbel}
*/
setReadOnly( dist, 'gumbel', require( '@stdlib/math/base/dist/gumbel' ) );

/**
* @name hypergeometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/hypergeometric}
*/

setReadOnly( dist, 'hypergeometric', require( '@stdlib/math/base/dist/hypergeometric' ) );

/**
* @name invgamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/invgamma}
*/
setReadOnly( dist, 'invgamma', require( '@stdlib/math/base/dist/invgamma' ) );

/**
* @name laplace
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/laplace}
*/
setReadOnly( dist, 'laplace', require( '@stdlib/math/base/dist/laplace' ) );

/**
* @name logistic
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/logistic}
*/
setReadOnly( dist, 'logistic', require( '@stdlib/math/base/dist/logistic' ) );

/**
* @name lognormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/lognormal}
*/
setReadOnly( dist, 'lognormal', require( '@stdlib/math/base/dist/lognormal' ) );

/**
* @name negativeBinomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/negative-binomial}
*/
setReadOnly( dist, 'negativeBinomial', require( '@stdlib/math/base/dist/negative-binomial' ) );

/**
* @name normal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/normal}
*/
setReadOnly( dist, 'normal', require( '@stdlib/math/base/dist/normal' ) );

/**
* @name pareto
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/pareto-type1}
*/
setReadOnly( dist, 'pareto', require( '@stdlib/math/base/dist/pareto-type1' ) );

/**
* @name poisson
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/poisson}
*/
setReadOnly( dist, 'poisson', require( '@stdlib/math/base/dist/poisson' ) );

/**
* @name rayleigh
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/rayleigh}
*/
setReadOnly( dist, 'rayleigh', require( '@stdlib/math/base/dist/rayleigh' ) );

/**
* @name t
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/t}
*/
setReadOnly( dist, 't', require( '@stdlib/math/base/dist/t' ) );

/**
* @name triangular
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/triangular}
*/
setReadOnly( dist, 'triangular', require( '@stdlib/math/base/dist/triangular' ) );

/**
* @name truncatedNormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/truncated-normal}
*/
setReadOnly( dist, 'truncatedNormal', require( '@stdlib/math/base/dist/truncated-normal' ) );

/**
* @name uniform
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/uniform}
*/
setReadOnly( dist, 'uniform', require( '@stdlib/math/base/dist/uniform' ) );

/**
* @name weibull
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/weibull}
*/
setReadOnly( dist, 'weibull', require( '@stdlib/math/base/dist/weibull' ) );

// EXPORTS //

module.exports = dist;
<commit_msg>Change name of exported pareto namespace<commit_after>'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace dist
*/
var dist = {};

/**
* @name beta
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/beta}
*/
setReadOnly( dist, 'beta', require( '@stdlib/math/base/dist/beta' ) );

/**
* @name binomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/binomial}
*/
setReadOnly( dist, 'binomial', require( '@stdlib/math/base/dist/binomial' ) );

/**
* @name cauchy
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/cauchy}
*/
setReadOnly( dist, 'cauchy', require( '@stdlib/math/base/dist/cauchy' ) );

/**
* @name chisquare
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/chisquare}
*/
setReadOnly( dist, 'chisquare', require( '@stdlib/math/base/dist/chisquare' ) );

/**
* @name degenerate
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/degenerate}
*/
setReadOnly( dist, 'degenerate', require( '@stdlib/math/base/dist/degenerate' ) );

/**
* @name erlang
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/erlang}
*/
setReadOnly( dist, 'erlang', require( '@stdlib/math/base/dist/erlang' ) );

/**
* @name exponential
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/exponential}
*/
setReadOnly( dist, 'exponential', require( '@stdlib/math/base/dist/exponential' ) );

/**
* @name f
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/f}
*/
setReadOnly( dist, 'f', require( '@stdlib/math/base/dist/f' ) );

/**
* @name gamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gamma}
*/
setReadOnly( dist, 'gamma', require( '@stdlib/math/base/dist/gamma' ) );

/**
* @name geometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/geometric}
*/
setReadOnly( dist, 'geometric', require( '@stdlib/math/base/dist/geometric' ) );

/**
* @name gumbel
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gumbel}
*/
setReadOnly( dist, 'gumbel', require( '@stdlib/math/base/dist/gumbel' ) );

/**
* @name hypergeometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/hypergeometric}
*/

setReadOnly( dist, 'hypergeometric', require( '@stdlib/math/base/dist/hypergeometric' ) );

/**
* @name invgamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/invgamma}
*/
setReadOnly( dist, 'invgamma', require( '@stdlib/math/base/dist/invgamma' ) );

/**
* @name laplace
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/laplace}
*/
setReadOnly( dist, 'laplace', require( '@stdlib/math/base/dist/laplace' ) );

/**
* @name logistic
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/logistic}
*/
setReadOnly( dist, 'logistic', require( '@stdlib/math/base/dist/logistic' ) );

/**
* @name lognormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/lognormal}
*/
setReadOnly( dist, 'lognormal', require( '@stdlib/math/base/dist/lognormal' ) );

/**
* @name negativeBinomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/negative-binomial}
*/
setReadOnly( dist, 'negativeBinomial', require( '@stdlib/math/base/dist/negative-binomial' ) );

/**
* @name normal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/normal}
*/
setReadOnly( dist, 'normal', require( '@stdlib/math/base/dist/normal' ) );

/**
* @name pareto1
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/pareto-type1}
*/
setReadOnly( dist, 'pareto1', require( '@stdlib/math/base/dist/pareto-type1' ) );

/**
* @name poisson
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/poisson}
*/
setReadOnly( dist, 'poisson', require( '@stdlib/math/base/dist/poisson' ) );

/**
* @name rayleigh
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/rayleigh}
*/
setReadOnly( dist, 'rayleigh', require( '@stdlib/math/base/dist/rayleigh' ) );

/**
* @name t
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/t}
*/
setReadOnly( dist, 't', require( '@stdlib/math/base/dist/t' ) );

/**
* @name triangular
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/triangular}
*/
setReadOnly( dist, 'triangular', require( '@stdlib/math/base/dist/triangular' ) );

/**
* @name truncatedNormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/truncated-normal}
*/
setReadOnly( dist, 'truncatedNormal', require( '@stdlib/math/base/dist/truncated-normal' ) );

/**
* @name uniform
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/uniform}
*/
setReadOnly( dist, 'uniform', require( '@stdlib/math/base/dist/uniform' ) );

/**
* @name weibull
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/weibull}
*/
setReadOnly( dist, 'weibull', require( '@stdlib/math/base/dist/weibull' ) );

// EXPORTS //

module.exports = dist;
<|endoftext|>


<commit_before>'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace dist
*/
var dist = {};

/**
* @name arcsine
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/arcsine}
*/
setReadOnly( dist, 'arcsine', require( '@stdlib/math/base/dist/arcsine' ) );

/**
* @name beta
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/beta}
*/
setReadOnly( dist, 'beta', require( '@stdlib/math/base/dist/beta' ) );

/**
* @name binomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/binomial}
*/
setReadOnly( dist, 'binomial', require( '@stdlib/math/base/dist/binomial' ) );

/**
* @name cauchy
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/cauchy}
*/
setReadOnly( dist, 'cauchy', require( '@stdlib/math/base/dist/cauchy' ) );

/**
* @name chisquare
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/chisquare}
*/
setReadOnly( dist, 'chisquare', require( '@stdlib/math/base/dist/chisquare' ) );

/**
* @name cosine
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/cosine}
*/
setReadOnly( dist, 'cosine', require( '@stdlib/math/base/dist/cosine' ) );

/**
* @name degenerate
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/degenerate}
*/
setReadOnly( dist, 'degenerate', require( '@stdlib/math/base/dist/degenerate' ) );

/**
* @name erlang
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/erlang}
*/
setReadOnly( dist, 'erlang', require( '@stdlib/math/base/dist/erlang' ) );

/**
* @name exponential
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/exponential}
*/
setReadOnly( dist, 'exponential', require( '@stdlib/math/base/dist/exponential' ) );

/**
* @name f
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/f}
*/
setReadOnly( dist, 'f', require( '@stdlib/math/base/dist/f' ) );

/**
* @name gamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gamma}
*/
setReadOnly( dist, 'gamma', require( '@stdlib/math/base/dist/gamma' ) );

/**
* @name geometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/geometric}
*/
setReadOnly( dist, 'geometric', require( '@stdlib/math/base/dist/geometric' ) );

/**
* @name gumbel
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gumbel}
*/
setReadOnly( dist, 'gumbel', require( '@stdlib/math/base/dist/gumbel' ) );

/**
* @name hypergeometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/hypergeometric}
*/

setReadOnly( dist, 'hypergeometric', require( '@stdlib/math/base/dist/hypergeometric' ) );

/**
* @name invgamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/invgamma}
*/
setReadOnly( dist, 'invgamma', require( '@stdlib/math/base/dist/invgamma' ) );

/**
* @name kumaraswamy
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/kumaraswamy}
*/
setReadOnly( dist, 'kumaraswamy', require( '@stdlib/math/base/dist/kumaraswamy' ) );

/**
* @name laplace
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/laplace}
*/
setReadOnly( dist, 'laplace', require( '@stdlib/math/base/dist/laplace' ) );

/**
* @name logistic
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/logistic}
*/
setReadOnly( dist, 'logistic', require( '@stdlib/math/base/dist/logistic' ) );

/**
* @name lognormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/lognormal}
*/
setReadOnly( dist, 'lognormal', require( '@stdlib/math/base/dist/lognormal' ) );

/**
* @name negativeBinomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/negative-binomial}
*/
setReadOnly( dist, 'negativeBinomial', require( '@stdlib/math/base/dist/negative-binomial' ) );

/**
* @name normal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/normal}
*/
setReadOnly( dist, 'normal', require( '@stdlib/math/base/dist/normal' ) );

/**
* @name pareto1
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/pareto-type1}
*/
setReadOnly( dist, 'pareto1', require( '@stdlib/math/base/dist/pareto-type1' ) );

/**
* @name poisson
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/poisson}
*/
setReadOnly( dist, 'poisson', require( '@stdlib/math/base/dist/poisson' ) );

/**
* @name rayleigh
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/rayleigh}
*/
setReadOnly( dist, 'rayleigh', require( '@stdlib/math/base/dist/rayleigh' ) );

/**
* @name t
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/t}
*/
setReadOnly( dist, 't', require( '@stdlib/math/base/dist/t' ) );

/**
* @name triangular
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/triangular}
*/
setReadOnly( dist, 'triangular', require( '@stdlib/math/base/dist/triangular' ) );

/**
* @name truncatedNormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/truncated-normal}
*/
setReadOnly( dist, 'truncatedNormal', require( '@stdlib/math/base/dist/truncated-normal' ) );

/**
* @name uniform
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/uniform}
*/
setReadOnly( dist, 'uniform', require( '@stdlib/math/base/dist/uniform' ) );

/**
* @name weibull
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/weibull}
*/
setReadOnly( dist, 'weibull', require( '@stdlib/math/base/dist/weibull' ) );

// EXPORTS //

module.exports = dist;
<commit_msg>Add packages to distribution namespace<commit_after>'use strict';

/*
* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-read-only-property' );

// MAIN //

/**
* Top-level namespace.
*
* @namespace dist
*/
var dist = {};

/**
* @name arcsine
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/arcsine}
*/
setReadOnly( dist, 'arcsine', require( '@stdlib/math/base/dist/arcsine' ) );

/**
* @name beta
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/beta}
*/
setReadOnly( dist, 'beta', require( '@stdlib/math/base/dist/beta' ) );

/**
* @name binomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/binomial}
*/
setReadOnly( dist, 'binomial', require( '@stdlib/math/base/dist/binomial' ) );

/**
* @name cauchy
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/cauchy}
*/
setReadOnly( dist, 'cauchy', require( '@stdlib/math/base/dist/cauchy' ) );

/**
* @name chi
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/chi}
*/
setReadOnly( dist, 'chi', require( '@stdlib/math/base/dist/chi' ) );

/**
* @name chisquare
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/chisquare}
*/
setReadOnly( dist, 'chisquare', require( '@stdlib/math/base/dist/chisquare' ) );

/**
* @name cosine
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/cosine}
*/
setReadOnly( dist, 'cosine', require( '@stdlib/math/base/dist/cosine' ) );

/**
* @name degenerate
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/degenerate}
*/
setReadOnly( dist, 'degenerate', require( '@stdlib/math/base/dist/degenerate' ) );

/**
* @name erlang
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/erlang}
*/
setReadOnly( dist, 'erlang', require( '@stdlib/math/base/dist/erlang' ) );

/**
* @name exponential
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/exponential}
*/
setReadOnly( dist, 'exponential', require( '@stdlib/math/base/dist/exponential' ) );

/**
* @name f
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/f}
*/
setReadOnly( dist, 'f', require( '@stdlib/math/base/dist/f' ) );

/**
* @name gamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gamma}
*/
setReadOnly( dist, 'gamma', require( '@stdlib/math/base/dist/gamma' ) );

/**
* @name geometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/geometric}
*/
setReadOnly( dist, 'geometric', require( '@stdlib/math/base/dist/geometric' ) );

/**
* @name gumbel
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/gumbel}
*/
setReadOnly( dist, 'gumbel', require( '@stdlib/math/base/dist/gumbel' ) );

/**
* @name hypergeometric
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/hypergeometric}
*/

setReadOnly( dist, 'hypergeometric', require( '@stdlib/math/base/dist/hypergeometric' ) );

/**
* @name invgamma
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/invgamma}
*/
setReadOnly( dist, 'invgamma', require( '@stdlib/math/base/dist/invgamma' ) );

/**
* @name kumaraswamy
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/kumaraswamy}
*/
setReadOnly( dist, 'kumaraswamy', require( '@stdlib/math/base/dist/kumaraswamy' ) );

/**
* @name laplace
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/laplace}
*/
setReadOnly( dist, 'laplace', require( '@stdlib/math/base/dist/laplace' ) );

/**
* @name levy
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/levy}
*/
setReadOnly( dist, 'levy', require( '@stdlib/math/base/dist/levy' ) );

/**
* @name logistic
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/logistic}
*/
setReadOnly( dist, 'logistic', require( '@stdlib/math/base/dist/logistic' ) );

/**
* @name lognormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/lognormal}
*/
setReadOnly( dist, 'lognormal', require( '@stdlib/math/base/dist/lognormal' ) );

/**
* @name negativeBinomial
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/negative-binomial}
*/
setReadOnly( dist, 'negativeBinomial', require( '@stdlib/math/base/dist/negative-binomial' ) );

/**
* @name normal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/normal}
*/
setReadOnly( dist, 'normal', require( '@stdlib/math/base/dist/normal' ) );

/**
* @name pareto1
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/pareto-type1}
*/
setReadOnly( dist, 'pareto1', require( '@stdlib/math/base/dist/pareto-type1' ) );

/**
* @name poisson
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/poisson}
*/
setReadOnly( dist, 'poisson', require( '@stdlib/math/base/dist/poisson' ) );

/**
* @name rayleigh
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/rayleigh}
*/
setReadOnly( dist, 'rayleigh', require( '@stdlib/math/base/dist/rayleigh' ) );

/**
* @name t
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/t}
*/
setReadOnly( dist, 't', require( '@stdlib/math/base/dist/t' ) );

/**
* @name triangular
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/triangular}
*/
setReadOnly( dist, 'triangular', require( '@stdlib/math/base/dist/triangular' ) );

/**
* @name truncatedNormal
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/truncated-normal}
*/
setReadOnly( dist, 'truncatedNormal', require( '@stdlib/math/base/dist/truncated-normal' ) );

/**
* @name uniform
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/uniform}
*/
setReadOnly( dist, 'uniform', require( '@stdlib/math/base/dist/uniform' ) );

/**
* @name weibull
* @memberof dist
* @readonly
* @type {Namespace}
* @see {@link module:@stdlib/math/base/dist/weibull}
*/
setReadOnly( dist, 'weibull', require( '@stdlib/math/base/dist/weibull' ) );

// EXPORTS //

module.exports = dist;
<|endoftext|>


<commit_before>"use strict";

var path = require("path");
var DEFAULT_EXPORT_EXPR = "module.exports";

function TransformWriter(file, body) {
    var exportExpressions = [];

    function addExportExpression(expression, operator) {
        operator = operator || ".";
        exportExpressions.push(DEFAULT_EXPORT_EXPR + operator + expression + ";");
    }

    this.decorateExport = function (type, args) {
        var expr = "(" + type + "(" + args.join(", ") + ")(" + DEFAULT_EXPORT_EXPR + ")) || " + DEFAULT_EXPORT_EXPR;
        addExportExpression(expr, " = ");
    };

    this.appendToDefaultExport = addExportExpression;

    this.appendToBody = function (content) {
        body += content;
    };

    Object.defineProperties(this, {
        filename: { value: path.basename(file) },
        body: {
            get: function () {
                var footer = exportExpressions.length > 0 ? exportExpressions.join("\n") + "\n" : "";
                return body + footer;
            }
        }
    });
}

TransformWriter.DEFAULT_EXPORT_EXPR = DEFAULT_EXPORT_EXPR;
module.exports = TransformWriter;
<commit_msg>Add a new line for each content appended to the body for transform writer.<commit_after>"use strict";

var path = require("path");
var DEFAULT_EXPORT_EXPR = "module.exports";

function TransformWriter(file, body) {
    var exportExpressions = [];

    function addExportExpression(expression, operator) {
        operator = operator || ".";
        exportExpressions.push(DEFAULT_EXPORT_EXPR + operator + expression + ";");
    }

    this.decorateExport = function (type, args) {
        var expr = "(" + type + "(" + args.join(", ") + ")(" + DEFAULT_EXPORT_EXPR + ")) || " + DEFAULT_EXPORT_EXPR;
        addExportExpression(expr, " = ");
    };

    this.appendToDefaultExport = addExportExpression;

    this.appendToBody = function (content) {
        body += content + "\n";
    };

    Object.defineProperties(this, {
        filename: { value: path.basename(file) },
        body: {
            get: function () {
                var footer = exportExpressions.length > 0 ? exportExpressions.join("\n") + "\n" : "";
                return body + footer;
            }
        }
    });
}

TransformWriter.DEFAULT_EXPORT_EXPR = DEFAULT_EXPORT_EXPR;
module.exports = TransformWriter;
<|endoftext|>


<commit_before>var Class = require('../../glayzzle/src/compat/class');

"use strict";

// declare the foo class
var foo = Class('father')
  .public({
    name: 'John Doe',
    __construct: function() {
      console.log('Hello world');
    }
  })
  .static({
    public: {
      foo: 123
    }
  })
.getPrototype();

// create an instance
var john = new foo();
console.log(john.name);
<commit_msg>test inheritance<commit_after>var Class = require('../../glayzzle/src/compat/class');

"use strict";

// declare the foo class
var foo = Class('foo')
  .public({
    name: 'John Doe',
    __construct: function() {
      console.log('Hello world');
    }
  })
  .static({
    public: {
      foo: 123
    }
  })
.getPrototype();

// create an instance
var john = new foo();
console.log('--', john.name);

// declare the foo class
var bar = Class('bar')
  .extends(foo)
  .public({
    name: 'John Bar',
    __construct: function() {
      console.log('Hello bar');
    }
  })
.getPrototype();

// create an instance
var john = new bar();
console.log('--', john.name);

<|endoftext|>


<commit_before>/**
* Copyright (c) Microsoft.  All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

var _ = require('underscore');
var async = require('async');
var es = require('event-stream');
var stream = require('readable-stream');
var util = require('util');

var Transform = stream.Transform;

var encoding = require('./token-cache-encoding');
var credStore = require('./win-credstore');

// Credential store has size limits, and tokens can
// go beyond them. 640k should be enough for everyone,
// right?
//
// As such, we have to be prepared to split a single
// credential across multiple credstore entries. This
// value controls the size of each chunk.

var MAX_CREDENTIAL_BYTES = 2048;

//
// Takes a single entry and credential, returns an array of
// entry/credential pairs ready to go to the credential store.
// @param{string} targetName target name that will be stored
// @param{string} tokens     string that will be stored as the
//                           actual credential.
//
// @returns {array} The possibly split set of entries for the
//                  credential store.
//
function splitEntry(targetName, tokens) {

  // Tokens are ascii, so # of bytes = # of characters.
  var numBytes = tokens.length;

  if (numBytes <= MAX_CREDENTIAL_BYTES) {
    return [ [targetName, tokens] ];
  }

  var numBlocks = Math.floor(numBytes / MAX_CREDENTIAL_BYTES);
  if (numBlocks % MAX_CREDENTIAL_BYTES != 0) {
    ++numBlocks;
  }

  var blocks = [];

  for(var i = 0; i < numBlocks; ++i) {
    blocks.push([util.format('%s--%d-%d', targetName, i, numBlocks),
      tokens.substr(i * MAX_CREDENTIAL_BYTES, MAX_CREDENTIAL_BYTES)]);
  }

  return blocks;
}

//
// entry joiner. This is written as a transform stream since
// the logic for reading the cred store is also stream based.
//

function JoinerStream() {
  this.entries = {};
  this.splitRe = /^(.*)--(\d+)-(\d+)$/;
  Transform.call(this, {objectMode: true});
}

util.inherits(JoinerStream, Transform);

_.extend(JoinerStream.prototype, {
  _transform: function (chunk, encoding, callback) {
    // object mode, chunk is actually an object of the form
    // { targetName: n, credential: c }
    var targetName = chunk.targetName;
    var credential = chunk.credential;

    var match = targetName.match(this.splitRe);
    if (match != null) {
      var mainTarget = match[1];
      var blockNum = +match[2];
      var numBlocks = +match[3];

      if (!_.has(this.entries, mainTarget)) {
        this.entries[mainTarget] = [];
      }

      this.entries[mainTarget][blockNum] = credential;

      if (_.compact(this.entries[mainTarget]).length === numBlocks) {
        this.push({
          targetName: mainTarget,
          credential: this.entries[mainTarget].join("")
        });
        delete this.entries[mainTarget];
      }
    } else {
      this.push(chunk);
    }
    callback();
  }
});

/**
 * Constructs a new token cache that stores credentials
 * in the Windows credential store.
 * @constructor
 */
 function CredStoreTokenCache() {
  this._entries = null;
 }

 //
// Internal helper functions for serializing and
// deserializing cache entries.
//

function deserializeBool(str) {
  return str.toLowerCase() === 'true';
}

function deserializeDate(str) {
  return new Date(str);
}

function deserializeNum(str) {
  return +str;
}

// Mapping of field names that need special handling
// on deserialization (typically type conversions)
// to the appropriate deserializer functions.
var fieldsToConvert = {
  expiresIn: deserializeNum,
  expiresOn: deserializeDate,
  isUserIdDisplayable: deserializeBool,
  isMRRT: deserializeBool
};

function deserializeEntry(entry) {
  return _.chain(entry)
    .pairs()
    .map(function (pair) {
      var key = pair[0], value = pair[1];
      if (_.has(fieldsToConvert, key)) {
        return [key, fieldsToConvert[key](value)];
      }
      return pair;
    })
    .object()
    .value();
}

_.extend(CredStoreTokenCache.prototype, {
  /**
  * Load the cache entries. Does a lazy load,
  * loads from OS on first request, otherwise
  * returns in-memory copy.
  *
  * @param {function(err, Array)} callback callback
  *                               receiving cache entries.
  */
  _loadEntries: function (callback) {
    var self = this;
    if (self._entries !== null) {
      return callback(null, self._entries);
    }

    var joiner = new JoinerStream();
    var entries = [];
    credStore.list()
      .pipe(joiner)
      .pipe(es.mapSync(function (entry) {
        // Most fields are stored in targetName,
        // access token and refresh token are stored in
        // credentials.
        var authResult = encoding.decodeObject(entry.targetName);
        var credential = encoding.decodeObject(new Buffer(entry.credential, 'hex').toString('utf8'));
        authResult.accessToken = credential.a;
        authResult.refreshToken = credential.r;

        return deserializeEntry(authResult);
      }))
      .on('data', function (entry) {
        entries.push(entry);
      })
      .on('end', function (err) {
        if (!err) {
          self._entries = entries;
        }
        callback(err, entries);
      });
  },

  isSecureCache: true,

  /**
   * Removes a collection of entries from the cache in a single batch operation.
   * @param  {Array}   entries  An array of cache entries to remove.
   * @param  {Function} callback This function is called when the operation is complete.  Any error is provided as the
   *                             first parameter.
   */
  remove: function remove(entries, callback) {
    var self = this;

    function shouldKeep(entry) {
      if (_.findWhere(entries, entry)) {
        return false;
      }
      return true;
    }

    self._loadEntries(function (err, _entries) {
      if (err) { return callback(err); }

      var grouped = _.groupBy(_entries, shouldKeep);
      var entriesToRemove = grouped[false] || [];
      var entriesToKeep = grouped[true] || [];

      function removeEntry(entry, removeCb) {
        var targetName = encoding.encodeObject(_.omit(entry, ['accessToken', 'refreshToken']));
        async.series([
          function (done) {
            credStore.remove(targetName, function () { done(); });
          },
          function (done) {
            credStore.remove(targetName + '--*', function () { done(); });
          }
        ], removeCb);
      }

      async.eachSeries(entriesToRemove, removeEntry, function (err) {
        if (err) { return callback(err); }
        self._entries = entriesToKeep;
        callback();
      });
    });
  },

  /**
   * Adds a collection of entries to the cache in a single batch operation.
   * @param {Array}   entries  An array of entries to add to the cache.
   * @param  {Function} callback This function is called when the operation is complete.  Any error is provided as the
   *                             first parameter.
   */
  add: function add(entries, callback) {
    var self = this;

    self._loadEntries(function (err, _entries) {
      if (err) { return callback(err); }

      // Remove any entries that are duplicates of the existing
      // cache elements.
      _.each(_entries, function(element) {
        _.each(entries, function(addElement, index) {
          if (_.isEqual(element, addElement)) {
            entries[index] = null;
          }
        });
      });

      // Add the new entries to the end of the cache.
      entries = _.compact(entries);

      // Add the new entries to the credstore
      function addToCredStore(entry, callback) {
        var targetName = encoding.encodeObject(_.omit(entry, ['accessToken', 'refreshToken']));
        var credential = encoding.encodeObject({a: entry.accessToken, r: entry.refreshToken});
        var entryParts = splitEntry(targetName, credential);

        async.eachSeries(entryParts,
          function (entry, entrycb) {
            credStore.set(entry[0], entry[1], entrycb);
          },
          function (err) {
            if (!err) {
              self._entries.push(entry);
              callback(err);
            }
          });
        }

      async.eachSeries(entries, addToCredStore, callback);
    });
  },

  /**
   * Finds all entries in the cache that match all of the passed in values.
   * @param  {object}   query    This object will be compared to each entry in the cache.  Any entries that
   *                             match all of the values in this object will be returned.  All the values
   *                             in the passed in object must match values in a potentialy returned object
   *                             exactly.  The returned object may have more values than the passed in query
   *                             object.
   * @param  {TokenCacheFindCallback} callback
   */
  find: function find(query, callback) {
    var self = this;

    self._loadEntries(function (err, _entries) {
      if (err) { return callback(err); }

      var results = _.where(_entries, query);
      callback(null, results);
    });
  }
});

module.exports = CredStoreTokenCache;
module.exports.splitEntry = splitEntry;
module.exports.JoinerStream = JoinerStream;
<commit_msg>Removed extraneous exports<commit_after>/**
* Copyright (c) Microsoft.  All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

var _ = require('underscore');
var async = require('async');
var es = require('event-stream');
var stream = require('readable-stream');
var util = require('util');

var Transform = stream.Transform;

var encoding = require('./token-cache-encoding');
var credStore = require('./win-credstore');

// Credential store has size limits, and tokens can
// go beyond them. 640k should be enough for everyone,
// right?
//
// As such, we have to be prepared to split a single
// credential across multiple credstore entries. This
// value controls the size of each chunk.

var MAX_CREDENTIAL_BYTES = 2048;

//
// Takes a single entry and credential, returns an array of
// entry/credential pairs ready to go to the credential store.
// @param{string} targetName target name that will be stored
// @param{string} tokens     string that will be stored as the
//                           actual credential.
//
// @returns {array} The possibly split set of entries for the
//                  credential store.
//
function splitEntry(targetName, tokens) {

  // Tokens are ascii, so # of bytes = # of characters.
  var numBytes = tokens.length;

  if (numBytes <= MAX_CREDENTIAL_BYTES) {
    return [ [targetName, tokens] ];
  }

  var numBlocks = Math.floor(numBytes / MAX_CREDENTIAL_BYTES);
  if (numBlocks % MAX_CREDENTIAL_BYTES != 0) {
    ++numBlocks;
  }

  var blocks = [];

  for(var i = 0; i < numBlocks; ++i) {
    blocks.push([util.format('%s--%d-%d', targetName, i, numBlocks),
      tokens.substr(i * MAX_CREDENTIAL_BYTES, MAX_CREDENTIAL_BYTES)]);
  }

  return blocks;
}

//
// entry joiner. This is written as a transform stream since
// the logic for reading the cred store is also stream based.
//

function JoinerStream() {
  this.entries = {};
  this.splitRe = /^(.*)--(\d+)-(\d+)$/;
  Transform.call(this, {objectMode: true});
}

util.inherits(JoinerStream, Transform);

_.extend(JoinerStream.prototype, {
  _transform: function (chunk, encoding, callback) {
    // object mode, chunk is actually an object of the form
    // { targetName: n, credential: c }
    var targetName = chunk.targetName;
    var credential = chunk.credential;

    var match = targetName.match(this.splitRe);
    if (match != null) {
      var mainTarget = match[1];
      var blockNum = +match[2];
      var numBlocks = +match[3];

      if (!_.has(this.entries, mainTarget)) {
        this.entries[mainTarget] = [];
      }

      this.entries[mainTarget][blockNum] = credential;

      if (_.compact(this.entries[mainTarget]).length === numBlocks) {
        this.push({
          targetName: mainTarget,
          credential: this.entries[mainTarget].join("")
        });
        delete this.entries[mainTarget];
      }
    } else {
      this.push(chunk);
    }
    callback();
  }
});

/**
 * Constructs a new token cache that stores credentials
 * in the Windows credential store.
 * @constructor
 */
 function CredStoreTokenCache() {
  this._entries = null;
 }

 //
// Internal helper functions for serializing and
// deserializing cache entries.
//

function deserializeBool(str) {
  return str.toLowerCase() === 'true';
}

function deserializeDate(str) {
  return new Date(str);
}

function deserializeNum(str) {
  return +str;
}

// Mapping of field names that need special handling
// on deserialization (typically type conversions)
// to the appropriate deserializer functions.
var fieldsToConvert = {
  expiresIn: deserializeNum,
  expiresOn: deserializeDate,
  isUserIdDisplayable: deserializeBool,
  isMRRT: deserializeBool
};

function deserializeEntry(entry) {
  return _.chain(entry)
    .pairs()
    .map(function (pair) {
      var key = pair[0], value = pair[1];
      if (_.has(fieldsToConvert, key)) {
        return [key, fieldsToConvert[key](value)];
      }
      return pair;
    })
    .object()
    .value();
}

_.extend(CredStoreTokenCache.prototype, {
  /**
  * Load the cache entries. Does a lazy load,
  * loads from OS on first request, otherwise
  * returns in-memory copy.
  *
  * @param {function(err, Array)} callback callback
  *                               receiving cache entries.
  */
  _loadEntries: function (callback) {
    var self = this;
    if (self._entries !== null) {
      return callback(null, self._entries);
    }

    var joiner = new JoinerStream();
    var entries = [];
    credStore.list()
      .pipe(joiner)
      .pipe(es.mapSync(function (entry) {
        // Most fields are stored in targetName,
        // access token and refresh token are stored in
        // credentials.
        var authResult = encoding.decodeObject(entry.targetName);
        var credential = encoding.decodeObject(new Buffer(entry.credential, 'hex').toString('utf8'));
        authResult.accessToken = credential.a;
        authResult.refreshToken = credential.r;

        return deserializeEntry(authResult);
      }))
      .on('data', function (entry) {
        entries.push(entry);
      })
      .on('end', function (err) {
        if (!err) {
          self._entries = entries;
        }
        callback(err, entries);
      });
  },

  isSecureCache: true,

  /**
   * Removes a collection of entries from the cache in a single batch operation.
   * @param  {Array}   entries  An array of cache entries to remove.
   * @param  {Function} callback This function is called when the operation is complete.  Any error is provided as the
   *                             first parameter.
   */
  remove: function remove(entries, callback) {
    var self = this;

    function shouldKeep(entry) {
      if (_.findWhere(entries, entry)) {
        return false;
      }
      return true;
    }

    self._loadEntries(function (err, _entries) {
      if (err) { return callback(err); }

      var grouped = _.groupBy(_entries, shouldKeep);
      var entriesToRemove = grouped[false] || [];
      var entriesToKeep = grouped[true] || [];

      function removeEntry(entry, removeCb) {
        var targetName = encoding.encodeObject(_.omit(entry, ['accessToken', 'refreshToken']));
        async.series([
          function (done) {
            credStore.remove(targetName, function () { done(); });
          },
          function (done) {
            credStore.remove(targetName + '--*', function () { done(); });
          }
        ], removeCb);
      }

      async.eachSeries(entriesToRemove, removeEntry, function (err) {
        if (err) { return callback(err); }
        self._entries = entriesToKeep;
        callback();
      });
    });
  },

  /**
   * Adds a collection of entries to the cache in a single batch operation.
   * @param {Array}   entries  An array of entries to add to the cache.
   * @param  {Function} callback This function is called when the operation is complete.  Any error is provided as the
   *                             first parameter.
   */
  add: function add(entries, callback) {
    var self = this;

    self._loadEntries(function (err, _entries) {
      if (err) { return callback(err); }

      // Remove any entries that are duplicates of the existing
      // cache elements.
      _.each(_entries, function(element) {
        _.each(entries, function(addElement, index) {
          if (_.isEqual(element, addElement)) {
            entries[index] = null;
          }
        });
      });

      // Add the new entries to the end of the cache.
      entries = _.compact(entries);

      // Add the new entries to the credstore
      function addToCredStore(entry, callback) {
        var targetName = encoding.encodeObject(_.omit(entry, ['accessToken', 'refreshToken']));
        var credential = encoding.encodeObject({a: entry.accessToken, r: entry.refreshToken});
        var entryParts = splitEntry(targetName, credential);

        async.eachSeries(entryParts,
          function (entry, entrycb) {
            credStore.set(entry[0], entry[1], entrycb);
          },
          function (err) {
            if (!err) {
              self._entries.push(entry);
              callback(err);
            }
          });
        }

      async.eachSeries(entries, addToCredStore, callback);
    });
  },

  /**
   * Finds all entries in the cache that match all of the passed in values.
   * @param  {object}   query    This object will be compared to each entry in the cache.  Any entries that
   *                             match all of the values in this object will be returned.  All the values
   *                             in the passed in object must match values in a potentialy returned object
   *                             exactly.  The returned object may have more values than the passed in query
   *                             object.
   * @param  {TokenCacheFindCallback} callback
   */
  find: function find(query, callback) {
    var self = this;

    self._loadEntries(function (err, _entries) {
      if (err) { return callback(err); }

      var results = _.where(_entries, query);
      callback(null, results);
    });
  }
});

module.exports = CredStoreTokenCache;
<|endoftext|>


<commit_before>import React from 'react'
import injectSheet from 'react-jss'
import PropTypes from 'prop-types'

import Notice from '../../components/Notice'
import Tool from '../../components/Tool'

import MorphForm from './MorphForm'
import MorphResults from './MorphResults'
import styles from './styles'

export const morphInfo = {
  title: 'Morph',
  link: 'morph',
  description:
    'is a tool for modeling historical sound change according to arbitrary rules of phonetic change. It can also be used to reverse historical sound change according to those same rules in order to guess at a word’s proto-language roots.'
}

const Morph = props => (
  <Tool toolInfo={morphInfo}>
    <Notice>This tool is still in planning.</Notice>
    <MorphForm styles={props.classes} />
    <MorphResults styles={props.classes} />
  </Tool>
)

Morph.propTypes = {
  classes: PropTypes.object
}

export default injectSheet(styles)(Morph)
<commit_msg>Remove reverse historical guessing from Morph description<commit_after>import React from 'react'
import injectSheet from 'react-jss'
import PropTypes from 'prop-types'

import Notice from '../../components/Notice'
import Tool from '../../components/Tool'

import MorphForm from './MorphForm'
import MorphResults from './MorphResults'
import styles from './styles'

export const morphInfo = {
  title: 'Morph',
  link: 'morph',
  description:
    'is a tool for modeling historical sound change according to arbitrary rules of phonetic change.'
}

const Morph = props => (
  <Tool toolInfo={morphInfo}>
    <Notice>This tool is still in planning.</Notice>
    <MorphForm styles={props.classes} />
    <MorphResults styles={props.classes} />
  </Tool>
)

Morph.propTypes = {
  classes: PropTypes.object
}

export default injectSheet(styles)(Morph)
<|endoftext|>


<commit_before>'use strict';

/**
 * @description Publish new assets from an uploaded tarball.
 */
exports.handler = function (req, res, next) {
  res.send(200);
  next();
};
<commit_msg>Un and re-tar to prep for bulk asset storage.<commit_after>'use strict';

const path = require('path');
const zlib = require('zlib');
const tar = require('tar-stream');
const logger = require('../../logging').getLogger();

/**
 * @description Publish new assets from an uploaded tarball.
 */
exports.handler = function (req, res, next) {
  const extract = tar.extract();
  const pack = tar.pack();

  extract.on('entry', (header, stream, next) => {
    if (header.type !== 'file') return next();
    const entryPath = header.name;
    const name = path.basename(entryPath);

    logger.debug('Received asset at path', { entryPath });

    const outs = pack.entry({ name, size: header.size }, (err) => {
      if (err) {
        return next();
      }

      logger.debug('Repacked asset for transit', { entryPath });

      next();
    });

    stream.pipe(outs);
  });

  extract.on('error', (err) => {
    logger.info('Corrupted tarball uploaded', {
      apikey: req.apikeyName,
      err: err.message,
      stack: err.stack
    });
  });

  extract.on('finish', () => {
    pack.finalize();

    res.send(200);
    next();
  });

  req.pipe(zlib.createGunzip()).pipe(extract);
};
<|endoftext|>


<commit_before>/**
 * React Starter Kit (https://www.reactstarterkit.com/)
 *
 * Copyright © 2014-present Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Stats.css';
import history from '../../core/history';
import _ from 'lodash';

class Stats extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      circonscriptions : {},
      circSelect : "",
      unfilledNumber : "",
      unfilledObject : {},
      oneTimeFilledNumber : "",
      oneTimeFilledObject : {},
      errorFilledNumber : "",
      errorFilledObject : {},
      allPVSNumber : "",
      allPVSObject : {},
      csvURL : ''
    };

    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleSelect = this.handleSelect.bind(this);
    this.redirectPV = this.redirectPV.bind(this);
    this.pvExtract = this.pvExtract.bind(this);
  }

  componentDidMount(){
    fetch('/api/Circonscription', {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        circonscriptions : json
      });
    })
    .catch((err) => {
      console.error(err);
    });
  }

  pvExtract(){
    let items = this.state.allPVSObject;
    let newArray = [],
        index = 0;

    if (items.length > 0){
      // clean data
      items = _.uniqBy(items, 'office');

      for(let i of items) {
        delete i.filledBy; delete i._id; delete i.__v;
        const off = i.office.toString().length === 10 ? ("0" + i.office.toString()) : i.office.toString(),
              circonscriptionId = off.substr(0,2),
              delegationId = off.substr(2,2),
              subDelegationId = off.substr(4,2),
              centerID = off.substr(6,3),
              stationId = off.substr(9,2),
              numberOfKeys = Object.keys(i).length ;

        newArray.push({
          "circonscriptionId": circonscriptionId,
          "delegationId": delegationId,
          "subDelegationId": subDelegationId,
          "centerID": centerID,
          "stationId": stationId,
          "registeredVoters": i.registeredVoters,
          "aSigningVoters": i.aSigningVoters,
          "bDeliveredBallots": i.bDeliveredBallots,
          "cSpoiledBallots": i.cSpoiledBallots,
          "dLeftBallots": i.dLeftBallots,
          "eCplusD": i.eCplusD,
          "fExtractedBallots": i.fExtractedBallots,
          "gEplusF": i.gEplusF,
          "hBminusG": i.hBminusG,
          "iAminusF": i.iAminusF,
          "jListVotes": i.jListVotes,
          "kCancelledVotes": i.kCancelledVotes,
          "lBlankVotes": i.lBlankVotes,
          "mJplusKplusL": i.mJplusKplusL,
          "nFminusM": i.nFminusM,
          "countingStart": i.countingStart,
          "countingEnd": i.countingEnd,
          "tampon": i.tampon
        });
        for(let x=15; x<numberOfKeys-5 ; x++) {
          newArray[index][Object.keys(i)[x]]= i[Object.keys(i)[x]] ;
        }
        index++;
      }

      const replacer = (key, value) => value === null ? '' : value ;// specify how you want to handle null values here
      const header = Object.keys(newArray[0]);
      let csv = newArray.map(row => header.map(fieldName => JSON.stringify(row[fieldName], replacer)).join(','));
      csv.unshift(header.join(','));
      csv = csv.join('\r\n');
      return csv;
    }
  }

  handleSubmit(e){
    e.preventDefault();
    // get unfilled PVs
    const circSelect = this.state.circSelect;
    fetch('/api/Rout/' + circSelect, {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        unfilledNumber : json.length,
        unfilledObject : json
      });
    })
    .catch((err) => {
      console.error(err);
    });

    // get 1 time filled PVs
    fetch('/api/Stats/' + circSelect + "/1", {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        oneTimeFilledNumber : json.length,
        oneTimeFilledObject : json
      });
    })
    .catch((err) => {
      console.error(err);
    });

    // get all PVs in circonscription
    fetch('/api/PVcirc/' + circSelect , {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        allPVSNumber : json.length,
        allPVSObject : json
      });
    })
    .then(() => {
      this.setState({
        csvURL : 'data:application/csv;charset=utf-8,' +  encodeURIComponent(this.pvExtract())
      });
    })
    .catch((err) => {
      console.error(err);
    });

    // get erronated PVs
    fetch('/api/OfficeError/' + circSelect, {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        errorFilledNumber : json.length,
        errorFilledObject : json
      });
    })
    .catch((err) => {
      console.error(err);
    });
  }

  handleSelect(e){
    this.setState({
      circSelect : e.target.value
    });
  }

  redirectPV(e, tocorrect){
    e.preventDefault();
    const off = e.target.textContent.replace(/\s/g, '').length === 10 ? "0" + e.target.textContent.replace(/\s/g, '') : e.target.textContent.replace(/\s/g, '') ,
          circonscriptionOffice = off.substr(0,2),
          delegation = off.substr(2,2),
          subDelegation = off.substr(4,2),
          center = off.substr(6,3),
          station = off.substr(9,2);
    // save in localStorage
    localStorage.setItem('circonscriptionOffice', circonscriptionOffice);
    localStorage.setItem('delegation', delegation);
    localStorage.setItem('subDelegation', subDelegation);
    localStorage.setItem('center', center);
    localStorage.setItem('station', station);
    localStorage.setItem('tocorrect', tocorrect);

    history.push('/');
  }

  render() {
    // array of circonscriptions
    const arr = this.state.circonscriptions;
    var list = Object.keys(arr).map((key, index) => {
      return <option key={ index + 1 } value={arr[key].name}> {arr[key].name} </option>
    });
    // array of unfilled Objects
    const unfilledObject = this.state.unfilledObject;
    var listUnfilled = Object.keys(unfilledObject).map((key, index) => {
      return <span key={ index + 1 } className={`${ s.col } ${ s.oneTen }`}> {unfilledObject[key].number}
    });
    // array of one time filled objects
    const oneTimeFilledObject = this.state.oneTimeFilledObject;
    var listOneTimeFilled = Object.keys(oneTimeFilledObject).map((key, index) => {
      return  this.redirectPV(e, false)} key={ index + 1 } className={`${ s.col } ${ s.oneTen } ${ s.tocorrect }`}> {oneTimeFilledObject[key].number}
    });
    // array of objects with errors
    const errorFilledObject = this.state.errorFilledObject;
    var listerrorFilled = Object.keys(errorFilledObject).map((key, index) => {
      return  this.redirectPV(e, true)} key={ index + 1 } className={`${ s.col } ${ s.oneTen } ${ s.tocorrect }`}> {errorFilledObject[key].number}
    });

    return (

{this.props.title}

          <form onSubmit={this.handleSubmit}>
            <div className={`${ s.row } ${ s.ltr }`}>

              <div className={`${ s.col } ${ s.oneThird }`}>
                <select className={`${s.select}`} onChange={this.handleSelect}>
                  <option default>Choisissez la circonscription</option>
                  {list}
                </select>

              <span className={`${ s.col } ${ s.oneThird } `}>
                <input type="submit" className={s.submit} value="rechercher" />

              <span className={`${ s.col } ${ s.oneThird } `}>
                <a href={ this.state.csvURL } className={`${ s.submit } ${ s.extract } `} target='_blank' download='myfi.csv' > Extraire PV remplis

            <div className={`${ s.row } ${s.ltr}`} >
              <span className={`${ s.col } ${ s.oneThird } ${s.ltr} ${s.head}`}> PVs manquants -  {this.state.unfilledNumber}

            <div className={`${ s.row } ${s.ltr}`} >
              {listUnfilled}

            <div className={`${ s.row } ${s.ltr}`} >
              <span className={`${ s.col } ${ s.oneThird } ${s.ltr} ${s.head}`}> PVs à resaisir une fois -  {this.state.oneTimeFilledNumber}

            <div className={`${ s.row } ${s.ltr}`} >
              {listOneTimeFilled}

            <div className={`${ s.row } ${s.ltr}`} >
              <span className={`${ s.col } ${ s.oneThird } ${s.ltr} ${s.head}`}> PVs erronés -  {this.state.errorFilledNumber}

            <div className={`${ s.row } ${s.ltr}`} >
              {listerrorFilled}

          </form>

    );
  }
}

export default withStyles(s)(Stats);
<commit_msg>update csv file name to match selection<commit_after>/**
 * React Starter Kit (https://www.reactstarterkit.com/)
 *
 * Copyright © 2014-present Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Stats.css';
import history from '../../core/history';
import _ from 'lodash';

class Stats extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      circonscriptions : {},
      circSelect : "",
      unfilledNumber : "",
      unfilledObject : {},
      oneTimeFilledNumber : "",
      oneTimeFilledObject : {},
      errorFilledNumber : "",
      errorFilledObject : {},
      allPVSNumber : "",
      allPVSObject : {},
      csvURL : ''
    };

    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleSelect = this.handleSelect.bind(this);
    this.redirectPV = this.redirectPV.bind(this);
    this.pvExtract = this.pvExtract.bind(this);
  }

  componentDidMount(){
    fetch('/api/Circonscription', {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        circonscriptions : json
      });
    })
    .catch((err) => {
      console.error(err);
    });
  }

  pvExtract(){
    let items = this.state.allPVSObject;
    let newArray = [],
        index = 0;

    if (items.length > 0){
      // clean data
      items = _.uniqBy(items, 'office');

      for(let i of items) {
        delete i.filledBy; delete i._id; delete i.__v;
        const off = i.office.toString().length === 10 ? ("0" + i.office.toString()) : i.office.toString(),
              circonscriptionId = off.substr(0,2),
              delegationId = off.substr(2,2),
              subDelegationId = off.substr(4,2),
              centerID = off.substr(6,3),
              stationId = off.substr(9,2),
              numberOfKeys = Object.keys(i).length ;

        newArray.push({
          "circonscriptionId": circonscriptionId,
          "delegationId": delegationId,
          "subDelegationId": subDelegationId,
          "centerID": centerID,
          "stationId": stationId,
          "registeredVoters": i.registeredVoters,
          "aSigningVoters": i.aSigningVoters,
          "bDeliveredBallots": i.bDeliveredBallots,
          "cSpoiledBallots": i.cSpoiledBallots,
          "dLeftBallots": i.dLeftBallots,
          "eCplusD": i.eCplusD,
          "fExtractedBallots": i.fExtractedBallots,
          "gEplusF": i.gEplusF,
          "hBminusG": i.hBminusG,
          "iAminusF": i.iAminusF,
          "jListVotes": i.jListVotes,
          "kCancelledVotes": i.kCancelledVotes,
          "lBlankVotes": i.lBlankVotes,
          "mJplusKplusL": i.mJplusKplusL,
          "nFminusM": i.nFminusM,
          "countingStart": i.countingStart,
          "countingEnd": i.countingEnd,
          "tampon": i.tampon
        });
        for(let x=15; x<numberOfKeys-5 ; x++) {
          newArray[index][Object.keys(i)[x]]= i[Object.keys(i)[x]] ;
        }
        index++;
      }

      const replacer = (key, value) => value === null ? '' : value ;// specify how you want to handle null values here
      const header = Object.keys(newArray[0]);
      let csv = newArray.map(row => header.map(fieldName => JSON.stringify(row[fieldName], replacer)).join(','));
      csv.unshift(header.join(','));
      csv = csv.join('\r\n');
      return csv;
    }
  }

  handleSubmit(e){
    e.preventDefault();
    // get unfilled PVs
    const circSelect = this.state.circSelect;
    fetch('/api/Rout/' + circSelect, {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        unfilledNumber : json.length,
        unfilledObject : json
      });
    })
    .catch((err) => {
      console.error(err);
    });

    // get 1 time filled PVs
    fetch('/api/Stats/' + circSelect + "/1", {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        oneTimeFilledNumber : json.length,
        oneTimeFilledObject : json
      });
    })
    .catch((err) => {
      console.error(err);
    });

    // get all PVs in circonscription
    fetch('/api/PVcirc/' + circSelect , {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        allPVSNumber : json.length,
        allPVSObject : json
      });
    })
    .then(() => {
      this.setState({
        csvURL : 'data:application/csv;charset=utf-8,' +  encodeURIComponent(this.pvExtract())
      });
    })
    .catch((err) => {
      console.error(err);
    });

    // get erronated PVs
    fetch('/api/OfficeError/' + circSelect, {
      method: 'GET',
      headers: {'Content-Type':'application/json'}
    })
    .then(res => res.json())
    .then((json) => {
      this.setState({
        errorFilledNumber : json.length,
        errorFilledObject : json
      });
    })
    .catch((err) => {
      console.error(err);
    });
  }

  handleSelect(e){
    this.setState({
      circSelect : e.target.value
    });
  }

  redirectPV(e, tocorrect){
    e.preventDefault();
    const off = e.target.textContent.replace(/\s/g, '').length === 10 ? "0" + e.target.textContent.replace(/\s/g, '') : e.target.textContent.replace(/\s/g, '') ,
          circonscriptionOffice = off.substr(0,2),
          delegation = off.substr(2,2),
          subDelegation = off.substr(4,2),
          center = off.substr(6,3),
          station = off.substr(9,2);
    // save in localStorage
    localStorage.setItem('circonscriptionOffice', circonscriptionOffice);
    localStorage.setItem('delegation', delegation);
    localStorage.setItem('subDelegation', subDelegation);
    localStorage.setItem('center', center);
    localStorage.setItem('station', station);
    localStorage.setItem('tocorrect', tocorrect);

    history.push('/');
  }

  render() {
    // array of circonscriptions
    const arr = this.state.circonscriptions;
    var list = Object.keys(arr).map((key, index) => {
      return <option key={ index + 1 } value={arr[key].name}> {arr[key].name} </option>
    });
    // array of unfilled Objects
    const unfilledObject = this.state.unfilledObject;
    var listUnfilled = Object.keys(unfilledObject).map((key, index) => {
      return <span key={ index + 1 } className={`${ s.col } ${ s.oneTen }`}> {unfilledObject[key].number}
    });
    // array of one time filled objects
    const oneTimeFilledObject = this.state.oneTimeFilledObject;
    var listOneTimeFilled = Object.keys(oneTimeFilledObject).map((key, index) => {
      return  this.redirectPV(e, false)} key={ index + 1 } className={`${ s.col } ${ s.oneTen } ${ s.tocorrect }`}> {oneTimeFilledObject[key].number}
    });
    // array of objects with errors
    const errorFilledObject = this.state.errorFilledObject;
    var listerrorFilled = Object.keys(errorFilledObject).map((key, index) => {
      return  this.redirectPV(e, true)} key={ index + 1 } className={`${ s.col } ${ s.oneTen } ${ s.tocorrect }`}> {errorFilledObject[key].number}
    });

    return (

{this.props.title}

          <form onSubmit={this.handleSubmit}>
            <div className={`${ s.row } ${ s.ltr }`}>

              <div className={`${ s.col } ${ s.oneThird }`}>
                <select className={`${s.select}`} onChange={this.handleSelect}>
                  <option default>Choisissez la circonscription</option>
                  {list}
                </select>

              <span className={`${ s.col } ${ s.oneThird } `}>
                <input type="submit" className={s.submit} value="rechercher" />

              <span className={`${ s.col } ${ s.oneThird } `}>
                <a href={ this.state.csvURL } className={`${ s.submit } ${ s.extract } `} target='_blank' download={`${ this.state.circSelect }.csv`} > Extraire PV remplis

            <div className={`${ s.row } ${s.ltr}`} >
              <span className={`${ s.col } ${ s.oneThird } ${s.ltr} ${s.head}`}> PVs manquants -  {this.state.unfilledNumber}

            <div className={`${ s.row } ${s.ltr}`} >
              {listUnfilled}

            <div className={`${ s.row } ${s.ltr}`} >
              <span className={`${ s.col } ${ s.oneThird } ${s.ltr} ${s.head}`}> PVs à resaisir une fois -  {this.state.oneTimeFilledNumber}

            <div className={`${ s.row } ${s.ltr}`} >
              {listOneTimeFilled}

            <div className={`${ s.row } ${s.ltr}`} >
              <span className={`${ s.col } ${ s.oneThird } ${s.ltr} ${s.head}`}> PVs erronés -  {this.state.errorFilledNumber}

            <div className={`${ s.row } ${s.ltr}`} >
              {listerrorFilled}

          </form>

    );
  }
}

export default withStyles(s)(Stats);
<|endoftext|>


<commit_before>import ext from "./utils/ext";

ext.runtime.onMessage.addListener(
  function(request, sender, sendResponse) {
    if(request.action === "perform-save") {
      console.log("Extension Type: ", "/* @echo extension */");
      console.log("PERFORM AJAX", request.data);

      sendResponse({ action: "saved" });
    }
  }
);<commit_msg>test commit for author<commit_after>import ext from "./utils/ext";

ext.runtime.onMessage.addListener(
  function(request, sender, sendResponse) {
    if(request.action === "perform-save") {
      console.log("Extension Type: ", "/* @echo extension */");
      console.log("PERFORM AJAX", request.data);
      sendResponse({ action: "saved" });
    }
  }
);<|endoftext|>


<commit_before>import { PolymerElement } from '@polymer/polymer/polymer-element.js';
import './shared-styles.js';
import '@polymer/paper-card/paper-card.js';
import './discussions/discussions-topic-post-item.js';
import './discussions/discussions-forum-item.js';
import './discussions/discussions-topic.js';
import './user/user-card.js';
import './content/content-activity-item.js';
import './content/content-module-card.js';
import './courses/course-item.js';
import './activities/user-activity-usage.js';
import './discussions/discussions-topic-post-reply-item.js';
import './updates/update-item.js';
import './updates/update-item-grades.js';
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
class SearchResultItem extends PolymerElement {
	static get template() {
		return html`

            <template is="dom-if" if="{{isThread}}">
                <d2l-discussions-topic-post-item href="{{result.href}}" token="{{result.token}}"></d2l-discussions-topic-post-item>
            </template>
            <template is="dom-if" if="{{isForum}}">
                <d2l-discussions-forum-item href="{{result.href}}" token="{{result.token}}"></d2l-discussions-forum-item>
            </template>
            <template is="dom-if" if="{{isTopic}}">
                <d2l-discussions-topic href="{{result.href}}" token="{{result.token}}"></d2l-discussions-topic>
            </template>
            <template is="dom-if" if="{{isCourseOffering}}">
                <d2l-course-item href="{{result.href}}" token="{{result.token}}"></d2l-course-item>
            </template>
            <template is="dom-if" if="{{isUser}}">
                <d2l-user-card href="{{result.href}}" token="{{result.token}}"></d2l-user-card>
            </template>
            <template is="dom-if" if="{{isActivity}}">
                <d2l-user-activity-usage href="{{result.href}}" token="{{result.token}}"></d2l-user-activity-usage>
            </template>
            <template is="dom-if" if="{{isPost}}">
                <d2l-discussions-topic-post-reply-item href="{{result.href}}" token="{{result.token}}"></d2l-discussions-topic-post-reply-item>
            </template>
            <template is="dom-if" if="{{isGrade}}">
                <d2l-update-item-grades href="{{result.href}}" token="{{result.token}}">
            </d2l-update-item-grades></template>
            <template is="dom-if" if="{{isNews}}">
                <d2l-update-item href="{{result.href}}" token="{{result.token}}">
            </d2l-update-item></template>
            <template is="dom-if" if="{{isModule}}">
                <d2l-content-module-card href="{{result.href}}" token="{{result.token}}">
            </d2l-content-module-card></template>
            <template is="dom-if" if="{{isContent}}">
                <d2l-content-activity-item href="{{result.href}}" token="{{result.token}}">
            </d2l-content-activity-item></template>
			<template is="dom-if" if="{{isNote}}">
                <d2l-note href="{{result.href}}" token="{{result.token}}">
            </d2l-note></template>
            <template is="dom-if" if="{{isAMystery}}">
                What the HYPERMEDIA is this?
            </template>

`;
	}

	static get is() { return 'd2l-search-result-item'; }

	static get properties() {
		return {
			result: Object,
			isThread: Boolean,
			isForum: Boolean,
			isTopic: Boolean,
			isCourseOffering: Boolean,
			isUser: Boolean,
			isActivity: Boolean,
			isPost: Boolean,
			isGrade: Boolean,
			isNews: Boolean,
			isContent: Boolean,
			isModule: Boolean,
			isNote: Boolean,
			isAMystery: Boolean
		};
	}

	static get observers() {
		return [
			'_resultChanged(result)'
		];
	}

	_resultChanged(result) {
		this.isAMystery = false;
		this.isThread = this.isForum = this.isTopic = this.isCourseOffering =
		this.isUser = this.isActivity = this.isPost = this.isGrade = this.isNews =
		this.isContent = this.isModule = this.isNote = false;
		switch (result.type) {
			case 'thread':
				this.isThread = true;
				break;
			case 'forum':
				this.isForum = true;
				break;
			case 'topic':
				this.isTopic = true;
				break;
			case 'course-offering':
				this.isCourseOffering = true;
				break;
			case 'user':
				this.isUser = true;
				break;
			case 'activity':
				this.isActivity = true;
				break;
			case 'post':
				this.isPost = true;
				break;
			case 'grade':
				this.isGrade = true;
				break;
			case 'news':
				this.isNews = true;
				break;
			case 'content':
				this.isContent = true;
				break;
			case 'module':
				this.isModule = true;
				break;
			case 'note':
				this.isNote = true;
				break;
			default:
				this.isAMystery = true;
		}
	}
}

window.customElements.define(SearchResultItem.is, SearchResultItem);
<commit_msg>Make search-result-item note item a contextual note<commit_after>import { PolymerElement } from '@polymer/polymer/polymer-element.js';
import './shared-styles.js';
import '@polymer/paper-card/paper-card.js';
import './discussions/discussions-topic-post-item.js';
import './discussions/discussions-forum-item.js';
import './discussions/discussions-topic.js';
import './user/user-card.js';
import './content/content-activity-item.js';
import './content/content-module-card.js';
import './courses/course-item.js';
import './activities/user-activity-usage.js';
import './discussions/discussions-topic-post-reply-item.js';
import './updates/update-item.js';
import './updates/update-item-grades.js';
import './notes/contextual-note.js';
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
class SearchResultItem extends PolymerElement {
	static get template() {
		return html`

            <template is="dom-if" if="{{isThread}}">
                <d2l-discussions-topic-post-item href="{{result.href}}" token="{{result.token}}"></d2l-discussions-topic-post-item>
            </template>
            <template is="dom-if" if="{{isForum}}">
                <d2l-discussions-forum-item href="{{result.href}}" token="{{result.token}}"></d2l-discussions-forum-item>
            </template>
            <template is="dom-if" if="{{isTopic}}">
                <d2l-discussions-topic href="{{result.href}}" token="{{result.token}}"></d2l-discussions-topic>
            </template>
            <template is="dom-if" if="{{isCourseOffering}}">
                <d2l-course-item href="{{result.href}}" token="{{result.token}}"></d2l-course-item>
            </template>
            <template is="dom-if" if="{{isUser}}">
                <d2l-user-card href="{{result.href}}" token="{{result.token}}"></d2l-user-card>
            </template>
            <template is="dom-if" if="{{isActivity}}">
                <d2l-user-activity-usage href="{{result.href}}" token="{{result.token}}"></d2l-user-activity-usage>
            </template>
            <template is="dom-if" if="{{isPost}}">
                <d2l-discussions-topic-post-reply-item href="{{result.href}}" token="{{result.token}}"></d2l-discussions-topic-post-reply-item>
            </template>
            <template is="dom-if" if="{{isGrade}}">
                <d2l-update-item-grades href="{{result.href}}" token="{{result.token}}">
            </d2l-update-item-grades></template>
            <template is="dom-if" if="{{isNews}}">
                <d2l-update-item href="{{result.href}}" token="{{result.token}}">
            </d2l-update-item></template>
            <template is="dom-if" if="{{isModule}}">
                <d2l-content-module-card href="{{result.href}}" token="{{result.token}}">
            </d2l-content-module-card></template>
            <template is="dom-if" if="{{isContent}}">
                <d2l-content-activity-item href="{{result.href}}" token="{{result.token}}">
            </d2l-content-activity-item></template>
			<template is="dom-if" if="{{isNote}}">
                <d2l-contextual-note href="{{result.href}}" token="{{result.token}}">
            </d2l-contextual-note></template>
            <template is="dom-if" if="{{isAMystery}}">
                What the HYPERMEDIA is this?
            </template>

`;
	}

	static get is() { return 'd2l-search-result-item'; }

	static get properties() {
		return {
			result: Object,
			isThread: Boolean,
			isForum: Boolean,
			isTopic: Boolean,
			isCourseOffering: Boolean,
			isUser: Boolean,
			isActivity: Boolean,
			isPost: Boolean,
			isGrade: Boolean,
			isNews: Boolean,
			isContent: Boolean,
			isModule: Boolean,
			isNote: Boolean,
			isAMystery: Boolean
		};
	}

	static get observers() {
		return [
			'_resultChanged(result)'
		];
	}

	_resultChanged(result) {
		this.isAMystery = false;
		this.isThread = this.isForum = this.isTopic = this.isCourseOffering =
		this.isUser = this.isActivity = this.isPost = this.isGrade = this.isNews =
		this.isContent = this.isModule = this.isNote = false;
		switch (result.type) {
			case 'thread':
				this.isThread = true;
				break;
			case 'forum':
				this.isForum = true;
				break;
			case 'topic':
				this.isTopic = true;
				break;
			case 'course-offering':
				this.isCourseOffering = true;
				break;
			case 'user':
				this.isUser = true;
				break;
			case 'activity':
				this.isActivity = true;
				break;
			case 'post':
				this.isPost = true;
				break;
			case 'grade':
				this.isGrade = true;
				break;
			case 'news':
				this.isNews = true;
				break;
			case 'content':
				this.isContent = true;
				break;
			case 'module':
				this.isModule = true;
				break;
			case 'note':
				this.isNote = true;
				break;
			default:
				this.isAMystery = true;
		}
	}
}

window.customElements.define(SearchResultItem.is, SearchResultItem);
<|endoftext|>


<commit_before>module.exports = {
    metadata: {
        plugin: "scene",
        label: "Scene",
        role: "actor",
        family: "scene",
        deviceTypes: ["philips-hue/hueBridge"],
        services: [{
            id: "on",
            label: "On"
        }, {
            id: "off",
            label: "Off"
        }, {
            id: "toggle",
            label: "Toggle"
        }],
        state: [{
            label: "Scenes",
            id: "scenes",
            type: {
                id: "any"
            }
        }, {
            label: "Rooms",
            id: "rooms",
            type: {
                id: "any"
            }
        }, {
            label: "Selected Scene",
            id: "selectedScene",
            type: {
                id: "any"
            }
        }, {
            label: "Selected Room",
            id: "selectedRoom",
            type: {
                id: "any"
            }
        }, {
            label: "Scene Active",
            id: "sceneActive",
            type: {
                id: "boolean"
            }
        }],
        configuration: [{
            label: "Scene Name",
            id: "sceneName",
            type: {
                id: "string"
            },
        }, {
            label: "Room Name",
            id: "roomName",
            type:{
                id: "string"
            }
        }]
    },
    create: function () {
        return new Scene();
    }
};

var q = require('q');
var hue = require('node-hue-api');

function Scene(){
    /**
     *
     */
    Scene.prototype.start = function(){
        var deferred = q.defer();

        if (!this.isSimulated()){

            this.state.sceneActive = false;
            var newScenes = [];

            this.device.hueApi.scenes()
                .then(function (result) {
                    for (var n in result) {
                        newScenes.push({sceneName: result[n].name, sceneId: result[n].id, Lights: result[n].lights});
                    }
                    this.publishStateChange();
                }.bind(this)).done();

            this.device.hueApi.groups()
                .then(function (group) {
                    for (var n in group) {
                        this.state.rooms.push({roomName: group[n].name, roomId: group[n].id, Lights: group[n].lights});
                    }
                    this.publishStateChange();
                }.bind(this)).done();

            for(var n in this.state.rooms) {
                if (this.state.selectedRoom === this.state.rooms[n].roomId)
                    for (var x in newScenes) {
                        if (this.state.rooms[n].Lights === newScenes[x].Lights) {
                            this.state.scenes.push({sceneName: newScenes[x].sceneName, sceneId: newScenes[x].sceneId});
                        }
                    }
            }

            this.publishStateChange();
        }
        deferred.resolve();

        return deferred.promise;
    };

    /**
     *
     */
    Scene.prototype.stop = function () {

    };

    /**
     *
     */
    Scene.prototype.getState = function () {

        var newScenes = [];

        this.device.hueApi.scenes()
            .then(function (result) {
                for (var n in result) {
                    newScenes.push({sceneName: result[n].name, sceneId: result[n].id, Lights: result[n].lights});
                }
            }.bind(this)).done();

        this.device.hueApi.groups()
            .then(function (group) {
                for (var n in group) {
                    this.state.rooms.push({roomName: group[n].name, roomId: group[n].id, Lights: group[n].lights});
                }
            }.bind(this)).done();

        for(var n in this.state.rooms) {
            if (this.state.selectedRoom === this.state.rooms[n].roomId) {
                for (var x in newScenes) {
                    if (this.state.rooms[n].Lights === newScenes[x].Lights) {
                        this.state.scenes.push({sceneName: newScenes[x].sceneName, sceneId: newScenes[x].sceneId});
                    }
                }
            }
        }

        this.publishStateChange();
        return this.state;
    };

    /**
     *
     */
    Scene.prototype.setState = function (state){
    };

    /**
     *
     */
    Scene.prototype.on = function () {
        this.state.sceneActive = true;
        if (this.isSimulated()) {
            //this.publishStateChange();
        } else {
            this.device.hueApi.activateScene(this.state.selectedScene).then(function(result){
                this.logDebug("Scene Active: ", result);
                this.publishStateChange();
            }.bind(this)).done();
        }
        this.publishStateChange();
    };

    /**
     *
     */
    Scene.prototype.off = function () {
        this.state.sceneActive = false;

        if (this.isSimulated()) {
            //this.publishStateChange();
        } else {
            this.device.hueApi.setGroupLightState(this.state.selectedRoom, hue.lightState.create().off()).then(function (result) {
                this.logDebug("Scene Not Active: ",result);
                this.publishStateChange();
                }.bind(this)).done();
        }
        this.publishStateChange();
    };

    /**
     *
     */
    Scene.prototype.toggle = function () {
        if (this.state.sceneActive) {
            this.off();
        }
        else {
            this.on();
        }
    };
}<commit_msg>Updated Scenes to utilize dropdown menu of scenes<commit_after>module.exports = {
    metadata: {
        plugin: "scene",
        label: "Scene",
        role: "actor",
        family: "scene",
        deviceTypes: ["philips-hue/hueBridge"],
        services: [{
            id: "on",
            label: "On"
        }, {
            id: "off",
            label: "Off"
        }, {
            id: "toggle",
            label: "Toggle"
        }],
        state: [{
            label: "Scenes",
            id: "scenes",
            type: {
                id: "any"
            }
        }, {
            label: "Rooms",
            id: "rooms",
            type: {
                id: "any"
            }
        }, {
            label: "Selected Scene",
            id: "selectedScene",
            type: {
                id: "any"
            }
        }, {
            label: "Selected Room",
            id: "selectedRoom",
            type: {
                id: "any"
            }
        }, {
            label: "Scene Active",
            id: "sceneActive",
            type: {
                id: "boolean"
            }
        }],
        configuration: [{
            label: "Scene Name",
            id: "sceneName",
            type: {
                id: "string"
            },
        }, {
            label: "Room Name",
            id: "roomName",
            type:{
                id: "string"
            }
        }]
    },
    create: function () {
        return new Scene();
    }
};

var q = require('q');
var hue = require('node-hue-api');

function Scene(){
    /**
     *
     */
    Scene.prototype.start = function(){
        var deferred = q.defer();

        if (!this.isSimulated()){

            var newScenes = [];

            this.device.hueApi.scenes()
                .then(function (result) {
                    for (var n in result) {
                        newScenes.push({sceneName: result[n].name, sceneId: result[n].id, Lights: result[n].lights});
                    }
                }.bind(this)).done();

            this.device.hueApi.groups()
                .then(function (group) {
                    for (var n in group) {
                        this.state.rooms.push({roomName: group[n].name, roomId: group[n].id, Lights: group[n].lights});
                    }
                    this.publishStateChange();
                    }.bind(this)).done();

            for(var n in this.state.rooms) {
                if (this.state.selectedRoom === this.state.rooms[n].roomId)
                    for (var x in newScenes) {
                        if (this.state.rooms[n].Lights === newScenes[x].Lights) {
                            this.state.scenes.push({sceneName: newScenes[x].sceneName, sceneId: newScenes[x].sceneId});
                        }
                    }
            }

            this.publishStateChange();
        }
        deferred.resolve();

        return deferred.promise;
    };

    /**
     *
     */
    Scene.prototype.stop = function () {

    };

    /**
     *
     */
    Scene.prototype.getState = function () {

        var newScenes = [];

        this.device.hueApi.scenes()
            .then(function (result) {
                for (var n in result) {
                    newScenes.push({sceneName: result[n].name, sceneId: result[n].id, Lights: result[n].lights});
                }
            }.bind(this)).done();

        this.device.hueApi.groups()
            .then(function (group) {
                for (var n in group) {
                    this.state.rooms.push({roomName: group[n].name, roomId: group[n].id, Lights: group[n].lights});
                    this.publishStateChange();
                }
            }.bind(this)).done();

        for(var n in this.state.rooms) {
            if (this.state.selectedRoom === this.state.rooms[n].roomId) {
                for (var x in newScenes) {
                    if (this.state.rooms[n].Lights === newScenes[x].Lights) {
                        this.state.scenes.push({sceneName: newScenes[x].sceneName, sceneId: newScenes[x].sceneId});
                    }
                }
            }
        }

        this.publishStateChange();
        return this.state;
    };

    /**
     *
     */
    Scene.prototype.setState = function (state){
    };

    /**
     *
     */
    Scene.prototype.on = function () {
        this.state.sceneActive = true;
        if (this.isSimulated()) {
            //this.publishStateChange();
        } else {
            this.device.hueApi.activateScene(this.state.selectedScene).then(function(result){
                this.logDebug("Scene Active: ", result);
                this.publishStateChange();
            }.bind(this)).done();
        }
        this.publishStateChange();
    };

    /**
     *
     */
    Scene.prototype.off = function () {
        this.state.sceneActive = false;

        if (this.isSimulated()) {
            //this.publishStateChange();
        } else {
            this.device.hueApi.setGroupLightState(this.state.selectedRoom, hue.lightState.create().off()).then(function (result) {
                this.logDebug("Scene Not Active: ",result);
                this.publishStateChange();
                }.bind(this)).done();
        }
        this.publishStateChange();
    };

    /**
     *
     */
    Scene.prototype.toggle = function () {
        if (this.state.sceneActive) {
            this.off();
        }
        else {
            this.on();
        }
    };
}<|endoftext|>


<commit_before>/**
 * Server
 */
function Server(config)
{
    EventEmitter.call(this);

    this.config     = config;
    this.app        = express();
    this.server     = new http.Server(this.app);
    this.clients    = new Collection([], 'id', true);
    this.controller = new GameController();

    this.authorizationHandler  = this.authorizationHandler.bind(this);
    this.onSocketConnection    = this.onSocketConnection.bind(this);
    this.onSocketDisconnection = this.onSocketDisconnection.bind(this);
    this.onError               = this.onError.bind(this);

    this.app.use(express['static']('web'));

    this.server.on('error', this.onError);
    this.server.on('upgrade', this.authorizationHandler);
    this.server.listen(config.port);

    console.info('Listening on port %s', config.port);

    for (var i = 0; i < 10; i++) {
        this.onSocketConnection(new MockedSocket(Math.random() * 5000), '192.168.0.' + i);
    }
}

Server.prototype = Object.create(EventEmitter.prototype);
Server.prototype.constructor = Server;

/**
 * Authorization Handler
 *
 * @param {Object} request
 * @param {Object} socket
 * @param {Buffer} body
 */
Server.prototype.authorizationHandler = function(request, socket, head)
{
    if (!WebSocket.isWebSocket(request)) {
        return socket.end();
    }

    var websocket = new WebSocket(request, socket, head, ['websocket'], {ping: 30}),
        ip = request.headers['x-real-ip'] || request.connection.remoteAddress;

    return this.onSocketConnection(websocket, ip);
};

/**
 * On socket connection
 *
 * @param {Socket} socket
 * @param {String} ip
 */
Server.prototype.onSocketConnection = function(socket, ip)
{
    var client = new SocketClient(socket, 1, ip);
    this.clients.add(client);

    client.on('close', this.onSocketDisconnection);
    this.controller.attach(client);
    this.emit('client', client);

    console.info('Client %s connected.', client.id);
};

/**
 * On socket connection
 *
 * @param {SocketClient} client
 */
Server.prototype.onSocketDisconnection = function(client)
{
    console.info('Client %s disconnected.', client.id);

    this.clients.remove(client);
};

/**
 * On error
 *
 * @param {Error} error
 */
Server.prototype.onError = function(error)
{
    console.error('Server Error:', error.stack);
};
<commit_msg>Removed bots<commit_after>/**
 * Server
 */
function Server(config)
{
    EventEmitter.call(this);

    this.config     = config;
    this.app        = express();
    this.server     = new http.Server(this.app);
    this.clients    = new Collection([], 'id', true);
    this.controller = new GameController();

    this.authorizationHandler  = this.authorizationHandler.bind(this);
    this.onSocketConnection    = this.onSocketConnection.bind(this);
    this.onSocketDisconnection = this.onSocketDisconnection.bind(this);
    this.onError               = this.onError.bind(this);

    this.app.use(express['static']('web'));

    this.server.on('error', this.onError);
    this.server.on('upgrade', this.authorizationHandler);
    this.server.listen(config.port);

    console.info('Listening on port %s', config.port);

    /*for (var i = 0; i < 10; i++) {
        this.onSocketConnection(new MockedSocket(Math.random() * 5000), '192.168.0.' + i);
    }*/
}

Server.prototype = Object.create(EventEmitter.prototype);
Server.prototype.constructor = Server;

/**
 * Authorization Handler
 *
 * @param {Object} request
 * @param {Object} socket
 * @param {Buffer} body
 */
Server.prototype.authorizationHandler = function(request, socket, head)
{
    if (!WebSocket.isWebSocket(request)) {
        return socket.end();
    }

    var websocket = new WebSocket(request, socket, head, ['websocket'], {ping: 30}),
        ip = request.headers['x-real-ip'] || request.connection.remoteAddress;

    return this.onSocketConnection(websocket, ip);
};

/**
 * On socket connection
 *
 * @param {Socket} socket
 * @param {String} ip
 */
Server.prototype.onSocketConnection = function(socket, ip)
{
    var client = new SocketClient(socket, 1, ip);
    this.clients.add(client);

    client.on('close', this.onSocketDisconnection);
    this.controller.attach(client);
    this.emit('client', client);

    console.info('Client %s connected.', client.id);
};

/**
 * On socket connection
 *
 * @param {SocketClient} client
 */
Server.prototype.onSocketDisconnection = function(client)
{
    console.info('Client %s disconnected.', client.id);

    this.clients.remove(client);
};

/**
 * On error
 *
 * @param {Error} error
 */
Server.prototype.onError = function(error)
{
    console.error('Server Error:', error.stack);
};
<|endoftext|>


<commit_before>// Resource list
var resources = []

m.request('db').then(function (data) {
  resources = Object.keys(data)
})

m.mount(
  document.getElementById('resources'),
  {
    view: function() {
      return m('ul', resources.map(function (resource) {
        return m('li',
          m('a', { href: resource }, resource)
        )
      }))
    }
  }
)

// Custom routes
var rules = {}

m.request('__rules').then(function (data) {
  rules = data
})

m.mount(
  document.getElementById('custom-routes'),
  {
    view: function () {
      return [
        m('p', 'And the custom routes:'),
        m('ul', Object.keys(rules).map(function (rule) {
          return m('li', rule + ' → ' + rules[rule])
        }))
      ]
    }
  }
)<commit_msg>Fix lint<commit_after>/* global m */

// Resource list
var resources = []

m.request('db').then(function (data) {
  resources = Object.keys(data)
})

m.mount(
  document.getElementById('resources'),
  {
    view: function () {
      return m('ul', resources.map(function (resource) {
        return m('li',
          m('a', { href: resource }, resource)
        )
      }))
    }
  }
)

// Custom routes
var rules = {}

m.request('__rules').then(function (data) {
  rules = data
})

m.mount(
  document.getElementById('custom-routes'),
  {
    view: function () {
      return [
        m('p', 'And the custom routes:'),
        m('ul', Object.keys(rules).map(function (rule) {
          return m('li', rule + ' → ' + rules[rule])
        }))
      ]
    }
  }
)
<|endoftext|>