UNPKG

clang-format-git

Version:

Node wrapper for git-clang-format Python script as a standalone native binary to allow execution without a Python dependency.🐉

2 lines 1.52 kB
#!/usr/bin/env node "use strict";function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}var _require=require("child_process"),spawn=_require.spawn;var _require2=require("clang-format-node"),clangFormatPath=_require2.clangFormatPath;var _require3=require("./utils/gitClangFormatPath"),gitClangFormatPath=_require3.gitClangFormatPath;var spawned=spawn(gitClangFormatPath,["--binary=".concat(clangFormatPath)].concat(_toConsumableArray(process.argv.slice(2))),{stdio:"inherit"});spawned.on("close",function(code){if(code!==0){console.error("Process exited with code: ".concat(code));process.exit(code)}});