[Pkg-javascript-commits] [node-is-buffer] 01/05: Import Upstream version 1.1.4
Sruthi Chandran
srud-guest at moszumanska.debian.org
Sun Oct 16 09:07:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
srud-guest pushed a commit to branch master
in repository node-is-buffer.
commit 385534d3e086f77155310948fce88fc176781e24
Author: Sruthi <srud at disroot.org>
Date: Sun Oct 16 14:20:22 2016 +0530
Import Upstream version 1.1.4
---
.travis.yml | 8 ++++++++
.zuul.yml | 14 ++++++++++++++
LICENSE | 21 +++++++++++++++++++++
README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
index.js | 21 +++++++++++++++++++++
package.json | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
test/basic.js | 25 +++++++++++++++++++++++++
7 files changed, 189 insertions(+)
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..24885a3
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+sudo: false
+language: node_js
+node_js:
+ - node
+env:
+ global:
+ - secure: du27W3wTgZ3G183axW7w0I01lOIurx8kilMH9p45VMfNXCu8lo6FLtLIQZxJ1FYMoJLQ1yfJTu2G0rq39SotDfJumsk6tF7BjTY/HKCocZaHqCMgw0W2bcylb5kMAdLhBNPlzejpPoWa1x1axbAHNFOLQNVosG/Bavu3/kuIIps=
+ - secure: Ax/5aekM40o67NuTkvQqx1DhfP86ZlHTtKbv5yI+WFmbjD3FQM8b8G1J/o7doaBDev7Mp+1zDJOK2pFGtt+JGRl0lM2JUmLh6yh/b28obXyei5iuUkqzKJLfKZHMbY5QW/1i4DUM+zSXe6Kava0qnqYg5wBBnrF6gLdsVsCGNQk=
diff --git a/.zuul.yml b/.zuul.yml
new file mode 100644
index 0000000..eb3cae6
--- /dev/null
+++ b/.zuul.yml
@@ -0,0 +1,14 @@
+ui: tape
+browsers:
+ - name: chrome
+ version: 39..latest
+ - name: firefox
+ version: 34..latest
+ - name: safari
+ version: 5..latest
+ - name: microsoftedge
+ version: latest
+ - name: ie
+ version: 8..latest
+ - name: android
+ version: 5.0..latest
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0c068ce
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Feross Aboukhadijeh
+
+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.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cb6f356
--- /dev/null
+++ b/README.md
@@ -0,0 +1,49 @@
+# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url]
+
+#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer))
+
+[![saucelabs][saucelabs-image]][saucelabs-url]
+
+[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg
+[travis-url]: https://travis-ci.org/feross/is-buffer
+[npm-image]: https://img.shields.io/npm/v/is-buffer.svg
+[npm-url]: https://npmjs.org/package/is-buffer
+[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg
+[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg
+[saucelabs-url]: https://saucelabs.com/u/is-buffer
+
+## Why not use `Buffer.isBuffer`?
+
+This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)).
+
+It's future-proof and works in node too!
+
+## install
+
+```bash
+npm install is-buffer
+```
+
+## usage
+
+```js
+var isBuffer = require('is-buffer')
+
+isBuffer(new Buffer(4)) // true
+
+isBuffer(undefined) // false
+isBuffer(null) // false
+isBuffer('') // false
+isBuffer(true) // false
+isBuffer(false) // false
+isBuffer(0) // false
+isBuffer(1) // false
+isBuffer(1.0) // false
+isBuffer('string') // false
+isBuffer({}) // false
+isBuffer(function foo () {}) // false
+```
+
+## license
+
+MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org).
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..36c808e
--- /dev/null
+++ b/index.js
@@ -0,0 +1,21 @@
+/*!
+ * Determine if an object is a Buffer
+ *
+ * @author Feross Aboukhadijeh <feross at feross.org> <http://feross.org>
+ * @license MIT
+ */
+
+// The _isBuffer check is for Safari 5-7 support, because it's missing
+// Object.prototype.constructor. Remove this eventually
+module.exports = function (obj) {
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
+}
+
+function isBuffer (obj) {
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
+}
+
+// For Node v0.10 support. Remove this eventually.
+function isSlowBuffer (obj) {
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..7915353
--- /dev/null
+++ b/package.json
@@ -0,0 +1,51 @@
+{
+ "name": "is-buffer",
+ "description": "Determine if an object is a Buffer",
+ "version": "1.1.4",
+ "author": {
+ "name": "Feross Aboukhadijeh",
+ "email": "feross at feross.org",
+ "url": "http://feross.org/"
+ },
+ "bugs": {
+ "url": "https://github.com/feross/is-buffer/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "standard": "^7.0.0",
+ "tape": "^4.0.0",
+ "zuul": "^3.0.0"
+ },
+ "keywords": [
+ "buffer",
+ "buffers",
+ "type",
+ "core buffer",
+ "browser buffer",
+ "browserify",
+ "typed array",
+ "uint32array",
+ "int16array",
+ "int32array",
+ "float32array",
+ "float64array",
+ "browser",
+ "arraybuffer",
+ "dataview"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/feross/is-buffer.git"
+ },
+ "scripts": {
+ "test": "standard && npm run test-node && npm run test-browser",
+ "test-browser": "zuul -- test/*.js",
+ "test-browser-local": "zuul --local -- test/*.js",
+ "test-node": "tape test/*.js"
+ },
+ "testling": {
+ "files": "test/*.js"
+ }
+}
diff --git a/test/basic.js b/test/basic.js
new file mode 100644
index 0000000..43b7c82
--- /dev/null
+++ b/test/basic.js
@@ -0,0 +1,25 @@
+var buffer = require('buffer')
+var isBuffer = require('../')
+var test = require('tape')
+
+test('is-buffer', function (t) {
+ t.equal(isBuffer(new Buffer(4)), true, 'new Buffer(4)')
+ t.equal(isBuffer(buffer.SlowBuffer(100)), true, 'SlowBuffer(100)')
+
+ t.equal(isBuffer(undefined), false, 'undefined')
+ t.equal(isBuffer(null), false, 'null')
+ t.equal(isBuffer(''), false, 'empty string')
+ t.equal(isBuffer(true), false, 'true')
+ t.equal(isBuffer(false), false, 'false')
+ t.equal(isBuffer(0), false, '0')
+ t.equal(isBuffer(1), false, '1')
+ t.equal(isBuffer(1.0), false, '1.0')
+ t.equal(isBuffer('string'), false, 'string')
+ t.equal(isBuffer({}), false, '{}')
+ t.equal(isBuffer([]), false, '[]')
+ t.equal(isBuffer(function foo () {}), false, 'function foo () {}')
+ t.equal(isBuffer({ isBuffer: null }), false, '{ isBuffer: null }')
+ t.equal(isBuffer({ isBuffer: function () { throw new Error() } }), false, '{ isBuffer: function () { throw new Error() } }')
+
+ t.end()
+})
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-is-buffer.git
More information about the Pkg-javascript-commits
mailing list