Comparing version 0.1.8 to 0.1.9
@@ -700,2 +700,66 @@ // Generated by CoffeeScript 1.9.0 | ||
this.size_of = function(x) { | ||
return this._size_of(x, new Map()); | ||
}; | ||
this._size_of = function(x, seen) { | ||
var CND, R, type; | ||
CND = require('./main'); | ||
R = 0; | ||
if (seen.has(x)) { | ||
return R; | ||
} | ||
seen.set(x, 1); | ||
switch (type = CND.type_of(x)) { | ||
case 'boolean': | ||
R += 4; | ||
break; | ||
case 'null': | ||
case 'jsundefined': | ||
case 'jsnan': | ||
R += 1; | ||
break; | ||
case 'text': | ||
case 'jsbuffer': | ||
R += x.length * 2; | ||
break; | ||
case 'number': | ||
R += 8; | ||
break; | ||
default: | ||
R += this._size_of_container(x, seen); | ||
} | ||
return R; | ||
}; | ||
this._size_of_container = function(x, seen) { | ||
var R, key, _i, _len, _ref; | ||
seen.set(x, 1); | ||
R = 0; | ||
_ref = Object.keys(x); | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
key = _ref[_i]; | ||
R += this._size_of(x[key], seen); | ||
} | ||
return R; | ||
}; | ||
this.get_local_ips = function() { | ||
/* thx to http://stackoverflow.com/a/10756441/256361 */ | ||
var R, description, interface_, _, _i, _len, _ref; | ||
R = []; | ||
_ref = (require('os')).networkInterfaces(); | ||
for (_ in _ref) { | ||
interface_ = _ref[_]; | ||
for (_i = 0, _len = interface_.length; _i < _len; _i++) { | ||
description = interface_[_i]; | ||
if (description['family'] === 'IPv4' && !description['internal']) { | ||
R.push(description['address']); | ||
} | ||
} | ||
} | ||
return R; | ||
}; | ||
}).call(this); |
{ | ||
"name": "cnd", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "a grab-bag NodeJS package mainly for functionalities that used to live in coffeenode-trm, coffeenode-bitsnpieces, and coffeenode-types", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147470
1807