mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Renamed lib because thats reasonable
This commit is contained in:
1 parent
f8749fb8d4
commit
70ecdf010c
3 files changed
+11
-10
No files matched your search
@@ -11,7 +11,7 @@ var hashFiles = require('hash-files');
|
|||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
|
||||||
// internal libraries
|
// internal libraries
|
||||||
var libomega = require("./lib/libomega.js");
|
var objectOps = require("./lib/objectOps.js");
|
||||||
var fileOps = require("./lib/fileOps.js");
|
var fileOps = require("./lib/fileOps.js");
|
||||||
|
|
||||||
// require config.json
|
// require config.json
|
||||||
@@ -486,7 +486,8 @@ function instanceManagement() {
|
|||||||
for(let key in flowStat1) totalFlows[key] = flowStat1[key];
|
for(let key in flowStat1) totalFlows[key] = flowStat1[key];
|
||||||
for(let key in flowStat2) totalFlows[key] = flowStat2[key];
|
for(let key in flowStat2) totalFlows[key] = flowStat2[key];
|
||||||
if(oldFlowStats && totalFlows && oldTimestamp) {
|
if(oldFlowStats && totalFlows && oldTimestamp) {
|
||||||
let payload = libomega.clone(totalFlows);
|
// todo: Migrate this to JSON.parse(JSON.stringify())
|
||||||
|
let payload = objectOps.clone(totalFlows);
|
||||||
// change from total reported to per time unit
|
// change from total reported to per time unit
|
||||||
for(let key in oldFlowStats) {
|
for(let key in oldFlowStats) {
|
||||||
// get production per minute
|
// get production per minute
|
||||||
|
|||||||
File renamed without changes.
@@ -1,12 +1,12 @@
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var libomega = require('./libomega');
|
var objectOps = require('./objectOps');
|
||||||
|
|
||||||
describe("libomega.js", function(){
|
describe("objectOps.js", function(){
|
||||||
describe("libomega.clone()", function(){
|
describe("objectOps.clone()", function(){
|
||||||
it("clones javascript objects", function(){
|
it("clones javascript objects", function(){
|
||||||
var object1 = {hello:"world", cat:{legs:4, name:"Kitty", colors:["brown", "yellow", "purple"]}};
|
var object1 = {hello:"world", cat:{legs:4, name:"Kitty", colors:["brown", "yellow", "purple"]}};
|
||||||
var object2 = {};
|
var object2 = {};
|
||||||
object2 = libomega.clone(object1);
|
object2 = objectOps.clone(object1);
|
||||||
|
|
||||||
assert.equal(object2.cat.name, object1.cat.name)
|
assert.equal(object2.cat.name, object1.cat.name)
|
||||||
assert.equal(object1.hello, object2.hello)
|
assert.equal(object1.hello, object2.hello)
|
||||||
@@ -14,18 +14,18 @@ describe("libomega.js", function(){
|
|||||||
it("does not deep clone objects", function(){
|
it("does not deep clone objects", function(){
|
||||||
var obj1 = {hello:"world", cat:{legs:4, name:"Kitty", colors:["brown", "yellow", "purple"]}};
|
var obj1 = {hello:"world", cat:{legs:4, name:"Kitty", colors:["brown", "yellow", "purple"]}};
|
||||||
var obj2 = {};
|
var obj2 = {};
|
||||||
obj2 = libomega.clone(obj1);
|
obj2 = objectOps.clone(obj1);
|
||||||
|
|
||||||
obj1.cat.colors = "black";
|
obj1.cat.colors = "black";
|
||||||
assert.equal(obj1.cat.colors, "black");
|
assert.equal(obj1.cat.colors, "black");
|
||||||
assert.notEqual(obj2.cat.colors[1], "yellow");
|
assert.notEqual(obj2.cat.colors[1], "yellow");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("libomega.deepclone()", function(){
|
describe("objectOps.deepclone()", function(){
|
||||||
it("deep clones javascript objects", function(){
|
it("deep clones javascript objects", function(){
|
||||||
var obj1 = {hello:"world", cat:{legs:4, name:"Kitty", colors:["brown", "yellow", "purple"]}};
|
var obj1 = {hello:"world", cat:{legs:4, name:"Kitty", colors:["brown", "yellow", "purple"]}};
|
||||||
var obj2 = {};
|
var obj2 = {};
|
||||||
obj2 = libomega.deepclone(obj1);
|
obj2 = objectOps.deepclone(obj1);
|
||||||
|
|
||||||
obj1.cat.colors = "black";
|
obj1.cat.colors = "black";
|
||||||
assert.equal(obj1.cat.colors, "black");
|
assert.equal(obj1.cat.colors, "black");
|
||||||
@@ -34,7 +34,7 @@ describe("libomega.js", function(){
|
|||||||
it("throws on non JSON parameters", function(){
|
it("throws on non JSON parameters", function(){
|
||||||
x = function(){};
|
x = function(){};
|
||||||
assert.throws(function(){
|
assert.throws(function(){
|
||||||
y = libomega.deepclone(x)
|
y = objectOps.deepclone(x)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user