pax_global_header00006660000000000000000000000064143215731640014520gustar00rootroot0000000000000052 comment=bc518a2415d77220c58a9038434f7daafaba8ba3 buffer-equal-1.0.1/000077500000000000000000000000001432157316400140755ustar00rootroot00000000000000buffer-equal-1.0.1/.eslintrc000066400000000000000000000003331432157316400157200ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "array-bracket-newline": 0, }, "overrides": [ { "files": "example/**", "rules": { "no-buffer-constructor": 0, "no-console": 0, }, }, ], } buffer-equal-1.0.1/.github/000077500000000000000000000000001432157316400154355ustar00rootroot00000000000000buffer-equal-1.0.1/.github/FUNDING.yml000066400000000000000000000011071432157316400172510ustar00rootroot00000000000000# These are supported funding model platforms github: [ljharb] patreon: # Replace with a single Patreon username open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: npm/buffer-equal community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] buffer-equal-1.0.1/.github/workflows/000077500000000000000000000000001432157316400174725ustar00rootroot00000000000000buffer-equal-1.0.1/.github/workflows/node-aught.yml000066400000000000000000000005161432157316400222520ustar00rootroot00000000000000name: 'Tests: node.js < 10' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '< 10' type: minors command: npm run tests-only node: name: 'node < 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' buffer-equal-1.0.1/.github/workflows/node-pretest.yml000066400000000000000000000002061432157316400226240ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main buffer-equal-1.0.1/.github/workflows/node-tens.yml000066400000000000000000000005211432157316400221070ustar00rootroot00000000000000name: 'Tests: node.js >= 10' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 10' type: minors command: npm run tests-only node: name: 'node >= 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' buffer-equal-1.0.1/.github/workflows/rebase.yml000066400000000000000000000004111432157316400214520ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] jobs: _: name: "Automatic Rebase" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ljharb/rebase@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} buffer-equal-1.0.1/.github/workflows/require-allow-edits.yml000066400000000000000000000003031432157316400241070ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] jobs: _: name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main buffer-equal-1.0.1/.gitignore000066400000000000000000000001721432157316400160650ustar00rootroot00000000000000# gitignore node_modules/ # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock .npmignore buffer-equal-1.0.1/.npmrc000066400000000000000000000000671432157316400152200ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s buffer-equal-1.0.1/CHANGELOG.md000066400000000000000000000070551432157316400157150ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [v1.0.1](https://github.com/inspect-js/buffer-equal/compare/v1.0.0...v1.0.1) - 2022-10-12 ### Commits - [eslint] fix indentation and whitespace [`94b97cd`](https://github.com/inspect-js/buffer-equal/commit/94b97cd8d3970fc8bd7d2eda3c074ccf7ee01659) - [readme] rename, add badges [`c08b77f`](https://github.com/inspect-js/buffer-equal/commit/c08b77f67e02432cdc60fd8424661ec92251f3cf) - [actions] add reusable workflows [`ea6a13d`](https://github.com/inspect-js/buffer-equal/commit/ea6a13ddf4e8dbd6c698787412540d4bd11a53c7) - [Tests] switch from `tap` to `tape` [`d4681ac`](https://github.com/inspect-js/buffer-equal/commit/d4681aca8a5909467862e6ae0b2c91a6f27ba458) - [meta] add `auto-changelog` [`50bd71a`](https://github.com/inspect-js/buffer-equal/commit/50bd71a3546e2e13f3c9af81b5f0c462efa897f1) - [eslint] add eslint [`084e09e`](https://github.com/inspect-js/buffer-equal/commit/084e09ed8751d0e390ffb7937508b1aed448f897) - [meta] create FUNDING.yml; add `funding` in package.json [`76b3e31`](https://github.com/inspect-js/buffer-equal/commit/76b3e317e16fad8f06e2bf727246028e7c2eb170) - [meta] use `npmignore` to autogenerate an npmignore file [`514a3b7`](https://github.com/inspect-js/buffer-equal/commit/514a3b7e39b4eaf229b0d078ec05f156ae372a5f) - Only apps should have lockfiles [`6e6963b`](https://github.com/inspect-js/buffer-equal/commit/6e6963baab8480210151e6216891bb9f6d880e76) - [meta] update URLs [`0973f5a`](https://github.com/inspect-js/buffer-equal/commit/0973f5a9a3675476adaaecef634c6f5ac46080c1) - [meta] add `safe-publish-latest` [`db19aab`](https://github.com/inspect-js/buffer-equal/commit/db19aabd4e38b07b7c5716006d9259fa2ef47ab1) - [Tests] add `aud` in `posttest` [`b108d28`](https://github.com/inspect-js/buffer-equal/commit/b108d2849332f6e99cefdfcdd1aaed423a19717e) ## [v1.0.0](https://github.com/inspect-js/buffer-equal/compare/v0.0.2...v1.0.0) - 2016-01-01 ## [v0.0.2](https://github.com/inspect-js/buffer-equal/compare/v0.0.1...v0.0.2) - 2016-01-01 ### Commits - add license file [`a7326b2`](https://github.com/inspect-js/buffer-equal/commit/a7326b2a0b34b98ba0d4d63cb126357175244847) ## [v0.0.1](https://github.com/inspect-js/buffer-equal/compare/v0.0.0...v0.0.1) - 2014-05-24 ### Commits - update node versions on travis [`0c246a1`](https://github.com/inspect-js/buffer-equal/commit/0c246a19136b82311e2289d629387a5e121796ef) - depend on an old tap version so that travis passes again since they don't have the latest npm [`daf11fc`](https://github.com/inspect-js/buffer-equal/commit/daf11fca167cf6931f9a6a8071e508fdf015e09a) - fix require() [`63e755d`](https://github.com/inspect-js/buffer-equal/commit/63e755dde568e0663314803c477de69efeea96af) - Use node 0.11+ buffer.equals when available [`e0131f8`](https://github.com/inspect-js/buffer-equal/commit/e0131f82eb2f0fa0d0fcb72963d83f75ddc338c1) ## v0.0.0 - 2012-05-11 ### Commits - readme test and example [`98c6019`](https://github.com/inspect-js/buffer-equal/commit/98c601934a06da2ef2085574ae7ff6da3eebe8ad) - added a package.json [`a8fc6c9`](https://github.com/inspect-js/buffer-equal/commit/a8fc6c93dfa95931eeaf5f0f4f6a9295c626a4a0) - working implementation [`ee448ef`](https://github.com/inspect-js/buffer-equal/commit/ee448efb8e3550fd234e78213b34bff59ae04055) - using travis [`2205205`](https://github.com/inspect-js/buffer-equal/commit/2205205c07a121cfabed2f696133638ded5302fa) buffer-equal-1.0.1/LICENSE000066400000000000000000000020611432157316400151010ustar00rootroot00000000000000This software is released under the MIT license: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. buffer-equal-1.0.1/README.md000066400000000000000000000037661432157316400153700ustar00rootroot00000000000000# buffer-equal [![Version Badge][npm-version-svg]][package-url] [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] Return whether two buffers are equal. ## example ``` js var bufferEqual = require('buffer-equal'); console.dir(bufferEqual( new Buffer([253,254,255]), new Buffer([253,254,255]) )); console.dir(bufferEqual( new Buffer('abc'), new Buffer('abcd') )); console.dir(bufferEqual( new Buffer('abc'), 'abc' )); ``` output: ```js true false undefined ``` ## methods ```js var bufferEqual = require('buffer-equal'); ``` bufferEqual(a, b) ----------------- Return whether the two buffers `a` and `b` are equal. If `a` or `b` is not a buffer, return `undefined`. ## install With [npm](http://npmjs.org) do: ``` npm install buffer-equal ``` ## license MIT [package-url]: https://npmjs.org/package/buffer-equal [npm-version-svg]: https://versionbadg.es/inspect-js/buffer-equal.svg [deps-svg]: https://david-dm.org/inspect-js/buffer-equal.svg [deps-url]: https://david-dm.org/inspect-js/buffer-equal [dev-deps-svg]: https://david-dm.org/inspect-js/buffer-equal/dev-status.svg [dev-deps-url]: https://david-dm.org/inspect-js/buffer-equal#info=devDependencies [npm-badge-png]: https://nodei.co/npm/buffer-equal.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/buffer-equal.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/buffer-equal.svg [downloads-url]: https://npm-stat.com/charts.html?package=buffer-equal [codecov-image]: https://codecov.io/gh/inspect-js/buffer-equal/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/inspect-js/buffer-equal/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/buffer-equal [actions-url]: https://github.com/inspect-js/buffer-equal/actions buffer-equal-1.0.1/example/000077500000000000000000000000001432157316400155305ustar00rootroot00000000000000buffer-equal-1.0.1/example/eq.js000066400000000000000000000004071432157316400164740ustar00rootroot00000000000000'use strict'; var bufferEqual = require('../'); console.dir(bufferEqual( new Buffer([253, 254, 255]), new Buffer([253, 254, 255]) )); console.dir(bufferEqual( new Buffer('abc'), new Buffer('abcd') )); console.dir(bufferEqual( new Buffer('abc'), 'abc' )); buffer-equal-1.0.1/index.js000066400000000000000000000006301432157316400155410ustar00rootroot00000000000000'use strict'; var Buffer = require('buffer').Buffer; // for use with browserify module.exports = function (a, b) { if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { return undefined; } if (typeof a.equals === 'function') { return a.equals(b); } if (a.length !== b.length) { return false; } for (var i = 0; i < a.length; i++) { if (a[i] !== b[i]) { return false; } } return true; }; buffer-equal-1.0.1/package.json000066400000000000000000000031151432157316400163630ustar00rootroot00000000000000{ "name": "buffer-equal", "description": "return whether two buffers are equal", "version": "1.0.1", "repository": { "type": "git", "url": "git://github.com/inspect-js/buffer-equal.git" }, "main": "index.js", "keywords": [ "buffer", "equal" ], "directories": { "example": "example", "test": "test" }, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", "prepublish": "not-in-publish || npm run prepublishOnly", "prepublishOnly": "safe-publish-latest", "lint": "eslint --ext=js,mjs .", "pretest": "npm run lint", "tests-only": "tape 'test/**/*.js'", "test": "npm run tests-only", "posttest": "aud --production", "version": "auto-changelog && git add CHANGELOG.md", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" }, "devDependencies": { "@ljharb/eslint-config": "^21.0.0", "aud": "^2.0.1", "auto-changelog": "^2.4.0", "eslint": "=8.8.0", "in-publish": "^2.0.1", "npmignore": "^0.3.0", "safe-publish-latest": "^2.0.0", "tape": "^5.6.1" }, "engines": { "node": ">=0.4" }, "license": "MIT", "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, "funding": { "url": "https://github.com/sponsors/ljharb" }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false, "hideCredit": true }, "publishConfig": { "ignore": [ ".github/workflows" ] } } buffer-equal-1.0.1/test/000077500000000000000000000000001432157316400150545ustar00rootroot00000000000000buffer-equal-1.0.1/test/eq.js000066400000000000000000000012101432157316400160110ustar00rootroot00000000000000'use strict'; var bufferEqual = require('../'); var test = require('tape'); test('equal', function (t) { var eq = bufferEqual( new Buffer([253, 254, 255]), new Buffer([253, 254, 255]) ); t.strictEqual(eq, true); t.end(); }); test('not equal', function (t) { var eq = bufferEqual( new Buffer('abc'), new Buffer('abcd') ); t.strictEqual(eq, false); t.end(); }); test('not equal not buffer', function (t) { var eq = bufferEqual( new Buffer('abc'), 'abc' ); t.strictEqual(eq, undefined); t.end(); }); test('equal not buffer', function (t) { var eq = bufferEqual('abc', 'abc'); t.strictEqual(eq, undefined); t.end(); });