"use strict";
/**
* @module opcua.utils
*/
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("node-opcua-assert").assert;
const path = require("path");
/**
* set a flag
* @method set_flag
* @param value
* @param mask<
* @return {number}
*/
function set_flag(value, mask) {
assert(mask !== undefined);
return value | mask.value;
}
exports.set_flag = set_flag;
/**
* check if a set of bits are set in the values
* @method check_flag
*
* @param value
* @param mask
* @return {boolean}
*/
function check_flag(value, mask) {
assert(mask !== undefined && mask.value);
return (value & mask.value) === mask.value;
}
exports.check_flag = check_flag;
// ---------------------------------------------------------------------------------------------------------------------
/**
* @method normalize_require_file
* @param baseFolder
* @param full_path_to_file
*
*
* @example:
* normalize_require_file("/home/bob/folder1/","/home/bob/folder1/folder2/toto.js").should.eql("./folder2/toto");
*/
function normalize_require_file(baseFolder, full_path_to_file) {
let local_file = path.relative(baseFolder, full_path_to_file).replace(/\\/g, "/");
// append ./ if necessary
if (local_file.substr(0, 1) !== ".") {
local_file = "./" + local_file;
}
// remove extension
local_file = local_file.substr(0, local_file.length - path.extname(local_file).length);
return local_file;
}
exports.normalize_require_file = normalize_require_file;
function isNullOrUndefined(value) {
return value === undefined || value === null;
}
exports.isNullOrUndefined = isNullOrUndefined;
var buffer_ellipsis_1 = require("./buffer_ellipsis");
exports.buffer_ellipsis = buffer_ellipsis_1.buffer_ellipsis;
var string_utils_1 = require("./string_utils");
exports.capitalizeFirstLetter = string_utils_1.capitalizeFirstLetter;
exports.lowerFirstLetter = string_utils_1.lowerFirstLetter;
var object_classname_1 = require("./object_classname");
exports.getObjectClassName = object_classname_1.getObjectClassName;
var get_clock_tick_1 = require("./get_clock_tick");
exports.get_clock_tick = get_clock_tick_1.get_clock_tick;
var compare_buffers_1 = require("./compare_buffers");
exports.compare_buffers = compare_buffers_1.compare_buffers;
var construct_filename_1 = require("./construct_filename");
exports.constructFilename = construct_filename_1.constructFilename;
var get_function_parameters_name_1 = require("./get_function_parameters_name");
exports.getFunctionParameterNames = get_function_parameters_name_1.getFunctionParameterNames;
var watchdog_1 = require("./watchdog");
exports.WatchDog = watchdog_1.WatchDog;
var linefile_1 = require("./linefile");
exports.LineFile = linefile_1.LineFile;
var set_deprecated_1 = require("./set_deprecated");
exports.setDeprecated = set_deprecated_1.setDeprecated;
//# sourceMappingURL=index.js.map