Skip to content

Instantly share code, notes, and snippets.

@dgmike
Created July 14, 2014 12:28
Show Gist options
  • Select an option

  • Save dgmike/ce3eb0205d1077c098d1 to your computer and use it in GitHub Desktop.

Select an option

Save dgmike/ce3eb0205d1077c098d1 to your computer and use it in GitHub Desktop.
node: creating an object of constants and extending it
"use strict";
var status, status_type;
status = {
OFFLINE: 0,
ONLINE: 1
};
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
status_type = Object.freeze(status);
export.status_type = status_type;
var _, status_type, status_type_intermetent;
_ = require('lodash'); // only for help pourpose
status_type = require('./status_type');
// status_type = { OFFLINE: 0, ONLINE: 1, CONNECTING: 2 }
status_type_intermetent = Object.freeze(
_.extend(
_.clone(status_type),
{ CONNECTING: 2 }
)
);
export.status_type_intermetent = status_type_intermetent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment