{"version":3,"sources":["jsdelivr-header.js","/npm/n-redis-commands@0.4.1/src/nodejs/commands.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,GAAK,QAAQ,MACb,KAAO,QAAQ,QACf,cAAgB,QAAQ,iBAY5B,OAAO,QAAU,SAAS,GACxB,IAAI,EAAc,KAAK,QAAQ,UAAW,KAAM,EAAU,QAEtD,EAAgB,GAAG,aAAa,EAAa,CAAC,SAAU,SAIxD,EAFS,cAAc,SAAS,0BAA4B,EAAgB,IAAK,CAAC,SAAU,SAExE,MAAM,oBAE9B,GAAI,OAAS,QAAc,IAAuB,EAAW,GAAI,MAAM,IAAI,MAAM,EAAU,oBAE3F,OAAO,EAAW,EACpB","file":"/npm/n-redis-commands@0.4.1/src/nodejs/commands.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/n-redis-commands@0.4.1/src/nodejs/commands.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var fs = require('fs');\nvar path = require('path');\nvar child_process = require('child_process');\n\n/**\n * Get Redis Command SHA\n *\n * NOTE: Uses ChildProcess.ExecSync requiring NodeJS v0.12 or higher\n *\n * @param {string} command name\n * @returns {string} commandSHA\n * @throws {error}\n * @sync\n */\nmodule.exports = function(command) {\n  var commandPath = path.resolve(__dirname, '..', command + '.lua');\n\n  var commandSource = fs.readFileSync(commandPath, {encoding: 'utf8'});\n\n  var result = child_process.execSync('redis-cli script load \"' + commandSource + '\"', {encoding: 'utf8'});\n\n  var commandSHA = result.match(/^([a-z0-9]{40})/g);\n\n  if (null === commandSHA || 'undefined' === typeof commandSHA[0]) throw new Error(command + '.lua invalid SHA');\n\n  return commandSHA[0];\n};"]}