Prefix clusterio/lib imports with lib

Use lib* prefix for the modules impored from the lib package to help
distinguish them more from ordinary variables.  Fix up the naming
convention for files to be consistently lowercase_underscore for
JavaScript files.
This commit is contained in:
Hornwitser committed 2020-10-23 21:22:43 +02:00
1 parent fbbaf3dd3a
commit 24397b75cc
55 files changed
+692 -668

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
"use strict";
var assert = require("assert");
var libObjectOps = require("@clusterio/lib/object_ops");
describe("lib/object_ops", function(){
describe("deepclone()", function(){
it("deep clones javascript objects", function(){
var obj1 = { hello: "world", cat: { legs: 4, name: "Kitty", colors: ["brown", "yellow", "purple"] }};
var obj2 = {};
obj2 = libObjectOps.deepclone(obj1);
obj1.cat.colors = "black";
assert.equal(obj1.cat.colors, "black");
assert.equal(obj2.cat.colors[1], "yellow");
});
it("throws on non JSON parameters", function(){
assert.throws(function(){
let y = libObjectOps.deepclone(libObjectOps.deepclone);
});
});
});
});