{"_id":"@a-2-c-2-anpm/vel-fugiat-consectetur","name":"@a-2-c-2-anpm/vel-fugiat-consectetur","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@a-2-c-2-anpm/vel-fugiat-consectetur","version":"1.0.0","description":"[![NPM Version](http://img.shields.io/npm/v/@a-2-c-2-anpm/vel-fugiat-consectetur.svg?style=flat-square)](https://npmjs.com/package/@a-2-c-2-anpm/vel-fugiat-consectetur) [![License](http://img.shields.io/npm/l/@a-2-c-2-anpm/vel-fugiat-consectetur.svg?style","main":"index.js","scripts":{},"author":{"name":"a-2-c-2-a"},"license":"MIT","dependencies":{"@a-2-c-2-anpm/alias-ducimus-sit":"^1.0.0","@a-2-c-2-anpm/atque-nemo-accusantium":"^1.0.0","@a-2-c-2-anpm/distinctio-quibusdam-culpa":"^1.0.0","@a-2-c-2-anpm/eligendi-praesentium-hic":"^1.0.0","@a-2-c-2-anpm/enim-amet-voluptatem":"^1.0.0","@a-2-c-2-anpm/error-dolorem-a":"^1.0.0","@a-2-c-2-anpm/excepturi-natus-facere":"^1.0.0","@a-2-c-2-anpm/expedita-recusandae-aut":"^1.0.0","@a-2-c-2-anpm/fugit-impedit-quae":"^1.0.0","@a-2-c-2-anpm/hic-maiores-accusantium":"^1.0.0","@a-2-c-2-anpm/laborum-exercitationem-quis":"^1.0.0","@a-2-c-2-anpm/laudantium-dolor-perspiciatis":"^1.0.0","@a-2-c-2-anpm/maiores-quis-dignissimos":"^1.0.0","@a-2-c-2-anpm/nam-eaque-occaecati":"^1.0.0","@a-2-c-2-anpm/neque-culpa-culpa":"^1.0.0","@a-2-c-2-anpm/neque-iste-eum":"^1.0.0","@a-2-c-2-anpm/nobis-similique-magni":"^1.0.0","@a-2-c-2-anpm/officia-tempore-ipsa":"^1.0.0","@a-2-c-2-anpm/perferendis-qui-suscipit":"^1.0.0","@a-2-c-2-anpm/placeat-suscipit-cumque":"^1.0.0","@a-2-c-2-anpm/quo-quia-expedita":"^1.0.0","@a-2-c-2-anpm/quos-voluptates-excepturi":"^1.0.0","@a-2-c-2-anpm/saepe-praesentium-iusto":"^1.0.0","@a-2-c-2-anpm/sint-ipsa-atque":"^1.0.0","@a-2-c-2-anpm/vitae-ad-molestiae":"^1.0.0","@ajhgwdjnpm/quas-mollitia-aspernatur-reprehenderit":"^1.0.0","calculator-3rd":"^1.0.12","mi-dex-func-3":"^1.0.0","vnhat-button-component":"^1.0.0","vnhat-forminput-component":"^1.0.1"},"keywords":["logging","language","npm","ajax","ebs","query","flatten","ES3","assertion","nope","censor","rds","stateless","wrap","Map","Array.prototype.flatMap","https","names","browser","command","length","toArray","concatMap","find-up","serializer","number","ascii","ECMAScript 2017","jasmine","StyleSheet","polyfill","findLast","pose","commander","react-hook-form","aws","cache","object","symbol","joi","enumerable","ArrayBuffer.prototype.slice","byteLength","JSON-Schema","obj","rm -fr","view","WeakSet","negative zero","buffers","ES2023","reduce","mapreduce","up","ES8","swf","shim","ender","assign","es7","rangeerror","plugin","lazy","fast-deep-clone","define","glacier","Object.entries","console","map","helper","kinesis","Array.prototype.flat","typesafe","package","debug","sequence","ECMAScript 2018","set","ArrayBuffer","function.length","sharedarraybuffer","installer","merge","sham","Object.getPrototypeOf","cli","utility","eventEmitter","limit","fullwidth","child","ES2016","json","airbnb","terminal","iterate","manager","redact","findup","prop","configurable","es-shims","spinners","simpledb","rm","regular-expression","espree","ECMAScript 2019","css-in-js","character","function","progress","parser","spec","es-abstract","spring","dir","flags","expression","bind","autoscaling","dom-testing-library","full-width","stringify","get","lockfile","package.json","fastclone","telephone","performance","value","isConcatSpreadable","slot","environment","remove","throttle","art","redirect","YAML","es2015","minimal","package manager","tdd","install","width","tostringtag","lint","group","CSS","ES","ses","_.extend","last","http","workflow","delete","validate","jest","Object","mobile","Uint8ClampedArray","ES5","ponyfill","toolkit","ArrayBuffer#slice","styled-components","scheme-validation","ECMAScript 2020","scheme","trim","drag","tc39","tester","callbind","functions","figlet","arraybuffer","0","name","atom","multi-package","transform","recursive","optimizer","cjk","packages","__proto__","module","wget","mkdirs","jsx","extra","call-bound","global","call-bind","resolve","html","Int8Array","shebang","client","copy","quote","binary","HyBi","subprocess","protocol-buffers","dataview","higher-order","deep-clone","zod","ECMAScript 2021","-0","task","intrinsic","cloudwatch","vest","format","es5","formatting","endpoint","bdd","findLastIndex","typeof","immutable","data"],"repository":{"type":"git","url":"git+https://github.com/a-2-c-2-anpm/vel-fugiat-consectetur.git"},"homepage":"https://github.com/a-2-c-2-anpm/vel-fugiat-consectetur/#readme","bugs":{"url":"https://github.com/a-2-c-2-anpm/vel-fugiat-consectetur/issues"},"_id":"@a-2-c-2-anpm/vel-fugiat-consectetur@1.0.0","gitHead":"ea7c90ba369220b7eefc92c6a202173c7c2158cb","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-0Zumho0xWKTo61O6cTeGP+2UUfDv03XcjzLlPXVzplTfiC/4X17XRZanlzcrtCmxPQcI5EyZlKsaKbG8jn2rwg==","shasum":"d0dbfd1067bbebee68149ef19053073a02ef8ccf","tarball":"https://registry.npmjs.org/@a-2-c-2-anpm/vel-fugiat-consectetur/-/vel-fugiat-consectetur-1.0.0.tgz","fileCount":8,"unpackedSize":14893,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBQTYd2H+xf99vCyzeVpm0KxQr67MfNnYjR2gEH1u//FAiB7EM2KJ5QnNLUzLZk0QCsXms3W52NiwWyCZt40XzPqIA=="}]},"_npmUser":{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"},"directories":{},"maintainers":[{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vel-fugiat-consectetur_1.0.0_1715418121226_0.2906438944451437"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-11T09:02:01.090Z","1.0.0":"2024-05-11T09:02:01.389Z","modified":"2024-05-11T09:02:01.817Z"},"maintainers":[{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"}],"description":"[![NPM Version](http://img.shields.io/npm/v/@a-2-c-2-anpm/vel-fugiat-consectetur.svg?style=flat-square)](https://npmjs.com/package/@a-2-c-2-anpm/vel-fugiat-consectetur) [![License](http://img.shields.io/npm/l/@a-2-c-2-anpm/vel-fugiat-consectetur.svg?style","homepage":"https://github.com/a-2-c-2-anpm/vel-fugiat-consectetur/#readme","keywords":["logging","language","npm","ajax","ebs","query","flatten","ES3","assertion","nope","censor","rds","stateless","wrap","Map","Array.prototype.flatMap","https","names","browser","command","length","toArray","concatMap","find-up","serializer","number","ascii","ECMAScript 2017","jasmine","StyleSheet","polyfill","findLast","pose","commander","react-hook-form","aws","cache","object","symbol","joi","enumerable","ArrayBuffer.prototype.slice","byteLength","JSON-Schema","obj","rm -fr","view","WeakSet","negative zero","buffers","ES2023","reduce","mapreduce","up","ES8","swf","shim","ender","assign","es7","rangeerror","plugin","lazy","fast-deep-clone","define","glacier","Object.entries","console","map","helper","kinesis","Array.prototype.flat","typesafe","package","debug","sequence","ECMAScript 2018","set","ArrayBuffer","function.length","sharedarraybuffer","installer","merge","sham","Object.getPrototypeOf","cli","utility","eventEmitter","limit","fullwidth","child","ES2016","json","airbnb","terminal","iterate","manager","redact","findup","prop","configurable","es-shims","spinners","simpledb","rm","regular-expression","espree","ECMAScript 2019","css-in-js","character","function","progress","parser","spec","es-abstract","spring","dir","flags","expression","bind","autoscaling","dom-testing-library","full-width","stringify","get","lockfile","package.json","fastclone","telephone","performance","value","isConcatSpreadable","slot","environment","remove","throttle","art","redirect","YAML","es2015","minimal","package manager","tdd","install","width","tostringtag","lint","group","CSS","ES","ses","_.extend","last","http","workflow","delete","validate","jest","Object","mobile","Uint8ClampedArray","ES5","ponyfill","toolkit","ArrayBuffer#slice","styled-components","scheme-validation","ECMAScript 2020","scheme","trim","drag","tc39","tester","callbind","functions","figlet","arraybuffer","0","name","atom","multi-package","transform","recursive","optimizer","cjk","packages","__proto__","module","wget","mkdirs","jsx","extra","call-bound","global","call-bind","resolve","html","Int8Array","shebang","client","copy","quote","binary","HyBi","subprocess","protocol-buffers","dataview","higher-order","deep-clone","zod","ECMAScript 2021","-0","task","intrinsic","cloudwatch","vest","format","es5","formatting","endpoint","bdd","findLastIndex","typeof","immutable","data"],"repository":{"type":"git","url":"git+https://github.com/a-2-c-2-anpm/vel-fugiat-consectetur.git"},"author":{"name":"a-2-c-2-a"},"bugs":{"url":"https://github.com/a-2-c-2-anpm/vel-fugiat-consectetur/issues"},"license":"MIT","readme":"# @a-2-c-2-anpm/vel-fugiat-consectetur\n[![NPM Version](http://img.shields.io/npm/v/@a-2-c-2-anpm/vel-fugiat-consectetur.svg?style=flat-square)](https://npmjs.com/package/@a-2-c-2-anpm/vel-fugiat-consectetur)\n[![License](http://img.shields.io/npm/l/@a-2-c-2-anpm/vel-fugiat-consectetur.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n[![Build Status](https://travis-ci.org/bjrmatos/@a-2-c-2-anpm/vel-fugiat-consectetur.png?branch=master)](https://travis-ci.org/bjrmatos/@a-2-c-2-anpm/vel-fugiat-consectetur)\n\n> **Evaluate a script function on a page with Chrome**\n\nThis module let you evaluate a script function on a page using Chrome (controlled with [puppeteer](https://github.com/GoogleChrome/puppeteer)) and get the return value of the evaluation in node.\n\n## Usage\n```html\n<!-- sample.html -->\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <title>Test page</title>\n</head>\n<body>\n  <div class=\"content\">1</div>\n  <div class=\"content\">2</div>\n  <div class=\"content\">3</div>\n  <div class=\"content\">4</div>\n</body>\n</html>\n```\n\n```js\nconst puppeteer = require('puppeteer')\nconst chromePageEval = require('@a-2-c-2-anpm/vel-fugiat-consectetur')\nconst chromeEval = chromePageEval({ puppeteer })\n\n(async () => {\n  try {\n    const result = await chromeEval({\n      html: '/path/to/sample.html',\n      scriptFn: `\n        function () {\n          let title = document.title\n\n          let content = Array.from(document.querySelectorAll('.content'), (node) => {\n            return node.textContent\n          })\n\n          return {\n            title,\n            content\n          }\n        }\n      `\n    })\n\n    console.log(result.title) // -> Test page\n    console.log(result.content) // -> [1, 2, 3, 4]\n  } catch (e) {\n    console.error('Error while trying to evaluate script:', e)\n  }\n})()\n```\n\n## Constructor options\n\n```js\nconst chromePageEval = require('@a-2-c-2-anpm/vel-fugiat-consectetur')\nconst chromeEval = chromePageEval({ /*[constructor options here]*/ })\n```\n\n- `puppeteer` **[required]** - the exported module from [puppeteer](https://github.com/GoogleChrome/puppeteer) that your app is going to use\n- properties with [any of the launch options supported by puppeteer](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions)\n\n## Evaluate options\n\n```js\nconst puppeteer = require('puppeteer')\nconst chromePageEval = require('@a-2-c-2-anpm/vel-fugiat-consectetur')\nconst chromeEval = chromePageEval({ puppeteer })\n\n(async () => {\n  const result = await chromeEval({ /*[evaluate options here]*/ })\n})()\n```\n\n- `html` **string** **[required]** - the path to the html file to load in a Chrome page\n- `scriptFn` **string** **[required]** - the script to evaluate in the Chrome page. the script must be a function that returns a value. ex: `scriptFn: 'function () { return 1 + 2}'`\n- `viewport` **object** - object with [any of the viewport options supported by puppeteer](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport)\n- `args` **array** - a list of custom arguments to pass to the `scriptFn` function. ex: `args: [1, 2]` and with `scriptFn: function (a, b) { return a + b}'` will produce `3` as result\n- `styles` **array<string>** - array of css strings to insert at the beginning of page's head element. ex: `styles: ['* { font-family: 'Calibri'; font-size: 16px; }']`\n- `waitForJS` **boolean** - when `true` the `scriptFn` won't be executed until the variable specified in `waitForJSVarName` option is set to true in page's javscript. defaults to `false`\n- `waitForJSVarName` **string** - name of the variable that will be used as trigger of `scriptFn`. defaults to `\"CHROME_PAGE_EVAL_READY\"`\n- `waitUntil` **string** - a value that specifies when a page is considered to be loaded, [for the list of all possible values and its meanings see `waitUntil` option in puppeteer docs](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagegotourl-options). defaults to the the default value of puppeteer\n- `timeout` **number** - time in ms to wait for the script evaluation to complete, when the timeout is reached the evaluation is cancelled. defaults to `30000`\n\n## Requirements\n\n- Install puppeteer >= 1.0.0 with `npm install puppeteer --save` in your project and pass it to `@a-2-c-2-anpm/vel-fugiat-consectetur` constructor function.\n\n## Caveats\n\n- What you return in your script function (`scriptFn` option) must be a [serializable value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description) in order to receive it properly, if a non serializable value is returned you will get `undefined` as the result.\n\n## Debugging\n\n- To get more information (internal debugging logs of the module) about what's happening during the evaluation on the page start your app in this way: `DEBUG=@a-2-c-2-anpm/vel-fugiat-consectetur* node [your-entry-file-here].js` (on Windows use `set DEBUG=@a-2-c-2-anpm/vel-fugiat-consectetur* && node [your-entry-file-here].js`). This will print out to the console some additional information about what's going on.\n\n- To see the Chrome instance created (the visible chrome window) run your app with the `CHROME_PAGE_EVAL_DEBUGGING` env var: `CHROME_PAGE_EVAL_DEBUGGING=true node [your-entry-file-here].js` (on Windows use `set CHROME_PAGE_EVAL_DEBUGGING=true && node [your-entry-file-here].js`).\n\n## License\nSee [license](https://github.com/a-2-c-2-anpm/vel-fugiat-consectetur/blob/master/LICENSE)\n","readmeFilename":"README.md"}