{"analyzedAt":"2022-06-28T16:37:37.781Z","collected":{"metadata":{"name":"serial-nci-scale","scope":"unscoped","version":"1.0.0","description":"Serial interface for Salter Brecknell PS-USB scales using NCI protocol and SCP-12 layout","keywords":["scale","serial","R232","3825","3835","SCP-12","PS-USB","Salter","Brecknell","NCI","Avery","Weigh-Tronix"],"date":"2021-03-18T14:47:44.659Z","author":{"name":"Chris Rudmin"},"publisher":{"username":"christopherr","email":"chris.rudmin@gmail.com"},"maintainers":[{"username":"christopherr","email":"chris.rudmin@gmail.com"}],"repository":{"type":"git","url":"git+ssh://git@github.com/chris-rudmin/serial-nci-scale.git"},"links":{"npm":"https://www.npmjs.com/package/serial-nci-scale","homepage":"https://chris-rudmin.github.io/serial-nci-scale/"},"license":"MIT","dependencies":{"core-js":"^3.8.2","regenerator-runtime":"^0.13.7"},"devDependencies":{"@babel/cli":"^7.12.10","@babel/core":"^7.12.3","@babel/preset-env":"^7.12.11","@pmmmwh/react-refresh-webpack-plugin":"0.4.2","@svgr/webpack":"5.4.0","@testing-library/jest-dom":"^5.11.8","@testing-library/react":"^11.2.2","@testing-library/user-event":"^12.6.0","@typescript-eslint/eslint-plugin":"^4.5.0","@typescript-eslint/parser":"^4.5.0","babel-eslint":"^10.1.0","babel-jest":"^26.6.0","babel-loader":"8.1.0","babel-plugin-named-asset-import":"^0.3.7","babel-preset-react-app":"^10.0.0","bfj":"^7.0.2","camelcase":"^6.1.0","case-sensitive-paths-webpack-plugin":"2.3.0","css-loader":"4.3.0","dotenv":"8.2.0","dotenv-expand":"5.1.0","eslint":"^7.11.0","eslint-config-react-app":"^6.0.0","eslint-plugin-flowtype":"^5.2.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jest":"^24.1.0","eslint-plugin-jsx-a11y":"^6.3.1","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-testing-library":"^3.9.2","eslint-webpack-plugin":"^2.1.0","file-loader":"6.1.1","fs-extra":"^9.0.1","html-webpack-plugin":"4.5.0","identity-obj-proxy":"3.0.0","jest":"26.6.0","jest-circus":"26.6.0","jest-resolve":"26.6.0","jest-watch-typeahead":"0.6.1","mini-css-extract-plugin":"0.11.3","optimize-css-assets-webpack-plugin":"5.0.4","pnp-webpack-plugin":"1.6.4","postcss-flexbugs-fixes":"4.2.1","postcss-loader":"3.0.0","postcss-normalize":"8.0.1","postcss-preset-env":"6.7.0","postcss-safe-parser":"5.0.2","prompts":"2.4.0","react":"^17.0.1","react-app-polyfill":"^2.0.0","react-dev-utils":"^11.0.1","react-dom":"^17.0.1","react-refresh":"^0.8.3","resolve":"1.18.1","resolve-url-loader":"^3.1.2","sass-loader":"8.0.2","semver":"7.3.2","style-loader":"1.3.0","terser-webpack-plugin":"4.2.3","ts-pnp":"1.2.0","url-loader":"4.1.1","web-vitals":"^0.2.4","webpack":"4.44.2","webpack-dev-server":"3.11.0","webpack-manifest-plugin":"2.2.0","workbox-webpack-plugin":"5.1.4","@material-ui/core":"^4.11.2"},"releases":[{"from":"2022-05-29T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":0},{"from":"2022-03-30T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":1},{"from":"2021-12-30T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":1},{"from":"2021-06-28T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":1},{"from":"2020-06-28T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":14}],"hasTestScript":true,"hasSelectiveFiles":true,"readme":"# Serial NCI Scale\n\nAn API to query a Serial Scale which supports the NCI protocal (SCP-12, NCI 3825, NCI 3835). Tested against the Salter Brecknell PS-USB scale. Depends on the Web Serial API.\n\n\n## Getting Started\n\nPage Hosting the library must be served over HTTPS.\nDemo is available at https://chris-rudmin.github.io/serial-nci-scale/\n\n### Installation\n\n```console\nnpm install serial-nci-scale --save\n```\n\n### Usage\n\n```js\nimport SerialNCIScale from 'serial-nci-scale';\n\nconst scale = new SerialNCIScale();\nconst { weight, units, status } = await scale.getWeight();\n```\n\n### Constructor\n- `const scale = new SerialNCIScale( [config] )` - Create a new instance with optional device filter array or port config object\n\n#### Config Object\n- `config.filters` - Optional - Array of [filters](https://wicg.github.io/serial/#serialportfilter-dictionary) to use when initializing the port. Defaults to [].\n- `config.portConfig` - Optional - Object containing [serial configuration](https://wicg.github.io/serial/#serialoptions-dictionary) to use for initializing port. Defaults to 7E1 byte format.\n\n#### Instance Methods\n\n- `scale.getWeight()` - Returns a promise which resolves with scale weight data. Required to be called from user action\n- `scale.getStatus()` - Returns a promise which resolves with scale status data. Required to be called from user action\n- `scale.zero()` - Returns a promise which resolves when the scale is zeroed. Required to be called from user action\n- `scale.startPolling([pollInterval])` - Starts polling the scale for weight data. Default polling interval is 500 ms Required to be called from user action\n- `scale.stopPolling()` - Stops polling the scale\n- `scale.disconnect()` - Returns a promise which resolves once disconnected. Closes the read and write streams and frees the serial port\n\n#### Static Attributes\n\n- `SerialNCIScale.isWebSerialSupported` - `true` if Web Serial API exists in your browser\n- `SerialNCIScale.supportedScaleFilters` - Array of devices which are known to be supported\n\n#### Events\n\nThe serial-nci-scale instance is an EventTarget and can be listened to for custom events. Scale data is contained the in the `detail` property.\n\n- `weight` - Dispatched for every weight read\n- `status` - Dispatched for every status read\n- `settled` - Dispatched when the scale is no longer in motion and if the weight is different than the last settled weight\n\n```js\nscale.addEventListener('settled', ({ detail }) => foo(detail.status));\nscale.startPolling();\n```\n\n### Supported Browsers\n\nCurrently only Chrome 89+ and Edge 89+ support the Web Serial API.\nEarlier versions of Chrome and Edge can use the API if it is enabled in chrome://flags"},"npm":{"downloads":[{"from":"2022-06-27T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":0},{"from":"2022-06-21T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":12},{"from":"2022-05-29T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":14},{"from":"2022-03-30T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":106},{"from":"2021-12-30T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":251},{"from":"2021-06-28T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":498}],"starsCount":0},"github":{"starsCount":1,"forksCount":0,"subscribersCount":2,"issues":{"count":2,"openCount":0,"distribution":{"3600":2,"10800":0,"32400":0,"97200":0,"291600":0,"874800":0,"2624400":0,"7873200":0,"23619600":0,"70858800":0,"212576400":0},"isDisabled":false},"contributors":[{"username":"chris-rudmin","commitsCount":51}],"commits":[{"from":"2022-06-21T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":0},{"from":"2022-05-29T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":0},{"from":"2022-03-30T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":0},{"from":"2021-12-30T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":0},{"from":"2021-06-28T00:00:00.000Z","to":"2022-06-28T00:00:00.000Z","count":1}],"statuses":[{"context":"github/pages","state":"success"}]},"source":{"files":{"readmeSize":2682,"testsSize":1648},"linters":["eslint"]}},"evaluation":{"quality":{"carefulness":0.9199999999999999,"tests":0.85,"health":1,"branding":0.4},"popularity":{"communityInterest":4,"downloadsCount":35.333333333333336,"downloadsAcceleration":-0.21691400304414002,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":1,"issuesDistribution":1}},"score":{"final":0.6521882550479987,"detail":{"quality":0.9682918371137965,"popularity":0.0334861451702772,"maintenance":0.9999444374407507}}}