Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

haraka-constants

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haraka-constants - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

.eslintrc.yaml

6

index.js

@@ -25,3 +25,3 @@ 'use strict';

if (k === 'connection') continue;
if (exports.hasOwnProperty(k)) {
if (Object.prototype.hasOwnProperty.call(exports, k)) {
object[k.toUpperCase()] = exports[k];

@@ -63,3 +63,3 @@ }

Object.keys(exports.connection.state).forEach((state) => {
exports.connection.state['STATE_' + state] = exports.connection.state[state];
})
exports.connection.state[`STATE_${state}`] = exports.connection.state[state];
})

@@ -6,3 +6,3 @@ {

"description": "Haraka constants",
"version": "1.0.5",
"version": "1.0.6",
"homepage": "http://haraka.github.io",

@@ -20,5 +20,5 @@ "repository": {

"devDependencies": {
"eslint": ">=3",
"eslint-plugin-haraka": "*",
"nodeunit": "*"
"eslint": ">=8",
"eslint-plugin-haraka": ">=1.0.10",
"mocha": "*"
},

@@ -30,6 +30,6 @@ "bugs": {

"scripts": {
"lint": "./node_modules/.bin/eslint *.js test/*.js",
"lintfix": "./node_modules/.bin/eslint --fix *.js test/*.js",
"test": "./run_tests"
"lint": "npx eslint *.js test",
"lintfix": "npx eslint --fix *.js test",
"test": "npx mocha"
}
}
[![Build Status][ci-img]][ci-url]
[![Coverage Status][cov-img]][cov-url]
[![Code Climate][clim-img]][clim-url]
[![Greenkeeper badge](https://badges.greenkeeper.io/haraka/haraka-constants.svg)](https://greenkeeper.io/)
[![NPM][npm-img]][npm-url]

@@ -29,4 +29,4 @@

```js
var constants = require('haraka-constants');
var myObj = {};
const constants = require('haraka-constants');
const myObj = {};
constants.import(myObj);

@@ -39,6 +39,6 @@

Converts a numeric constant to it's string representation.
Converts a numeric constant to its string representation.
```js
var constants = require('haraka-constants');
const constants = require('haraka-constants');
// 'CONT' === constants.translate(900);

@@ -48,4 +48,4 @@ ```

[ci-img]: https://travis-ci.org/haraka/haraka-constants.svg?branch=master
[ci-url]: https://travis-ci.org/haraka/haraka-constants
[ci-img]: https://github.com/haraka/haraka-constants/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/haraka/haraka-constants/actions/workflows/ci.yml
[cov-img]: https://codecov.io/github/haraka/haraka-constants/coverage.svg

@@ -52,0 +52,0 @@ [cov-url]: https://codecov.io/github/haraka/haraka-constants?branch=master

const assert = require('assert')
const node_const = require('constants');

@@ -7,47 +9,32 @@

exports.constants = {
'cont' : function (test) {
test.expect(1);
test.equal(constants.cont, 900);
test.done();
},
'CONT' : function (test) {
test.expect(1);
test.equal(constants.CONT, 900);
test.done();
},
'stop' : function (test) {
test.expect(1);
test.equal(constants.stop, 901);
test.done();
},
'deny' : function (test) {
test.expect(1);
test.equal(constants.deny, 902);
test.done();
},
'DENY' : function (test) {
test.expect(1);
test.equal(constants.DENY, 902);
test.done();
},
'WRITE_EXCL' : function (test) {
test.expect(1);
test.equal(constants.WRITE_EXCL, write_excl_val);
test.done();
}
}
describe('constants', function () {
it('cont', function () {
assert.equal(constants.cont, 900);
})
it('CONT', function () {
assert.equal(constants.CONT, 900);
})
it('stop', function () {
assert.equal(constants.stop, 901);
})
it('deny', function () {
assert.equal(constants.deny, 902);
})
it('DENY', function () {
assert.equal(constants.DENY, 902);
})
it('WRITE_EXCL', function () {
assert.equal(constants.WRITE_EXCL, write_excl_val);
})
})
exports.import = {
'exists as function' : function (test) {
test.expect(1);
test.equal(typeof constants.import, 'function');
test.done();
},
'populates an object' : function (test) {
test.expect(1);
describe('import', function () {
it('exists as function', function () {
assert.equal(typeof constants.import, 'function');
})
it('populates an object', function () {
const newObj = {};
constants.import(newObj);
delete newObj.connection;
test.deepEqual(newObj,
assert.deepEqual(newObj,
{

@@ -67,41 +54,28 @@ CONT: 900,

);
test.done();
}
};
})
})
exports.translate = {
'converts num to str' : function (test) {
test.expect(2);
test.equal('CONT', constants.translate(900));
test.equal('DENY', constants.translate(902));
test.done();
},
'UNKNOWN' : function (test) {
test.expect(1);
test.equal('UNKNOWN', constants.translate(800));
test.done();
},
};
describe('translate', function () {
it('converts num to str', function () {
assert.equal('CONT', constants.translate(900));
assert.equal('DENY', constants.translate(902));
})
it('UNKNOWN', function () {
assert.equal('UNKNOWN', constants.translate(800));
})
})
exports.connection = {
'has connection state CMD' : function (test) {
test.expect(1);
test.equal(constants.connection.state.CMD, 1);
test.done();
},
'has connection state STATE_CMD' : function (test) {
test.expect(1);
test.equal(constants.connection.state.STATE_CMD, 1);
test.done();
},
'has connection state DISCONNECTED' : function (test) {
test.expect(1);
test.equal(constants.connection.state.DISCONNECTED, 100);
test.done();
},
'has connection state STATE_DISCONNECTED' : function (test) {
test.expect(1);
test.equal(constants.connection.state.STATE_DISCONNECTED, 100);
test.done();
},
}
describe('connection', function () {
it('has connection state CMD', function () {
assert.equal(constants.connection.state.CMD, 1);
})
it('has connection state STATE_CMD', function () {
assert.equal(constants.connection.state.STATE_CMD, 1);
})
it('has connection state DISCONNECTED', function () {
assert.equal(constants.connection.state.DISCONNECTED, 100);
})
it('has connection state STATE_DISCONNECTED', function () {
assert.equal(constants.connection.state.STATE_DISCONNECTED, 100);
})
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc