UNPKG

qpace

Version:

📊 The Quant SDK for Python and Javascript. Written in Rust.

69 lines (68 loc) • 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: true, get: Object.getOwnPropertyDescriptor(all, name).get }); } _export(exports, { get isLinux () { return isLinux; }, get isMacOs () { return isMacOs; }, get isWindows () { return isWindows; }, get which () { return which; }, get workerCpuCount () { return workerCpuCount; } }); function _os() { const data = /*#__PURE__*/ _interop_require_default(require("os")); _os = function() { return data; }; return data; } function _which() { const data = /*#__PURE__*/ _interop_require_default(require("which")); _which = function() { return data; }; return data; } function _interop_require_default(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const isMacOs = ()=>{ return process.platform === "darwin"; }; const isWindows = ()=>{ return process.platform === "win32"; }; const isLinux = ()=>{ return process.platform === "linux"; }; const workerCpuCount = ()=>{ const cpus = _os().default.cpus(); if (isWindows()) { return Math.max(1, cpus.length - 2); } return cpus.length; }; const which = async (cmd)=>{ const path = await (0, _which().default)(cmd, { nothrow: true }); return path; };