array-source
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,2 +0,2 @@ | ||
// https://github.com/mbostock/array-source Version 0.0.2. Copyright 2016 Mike Bostock. | ||
// https://github.com/mbostock/array-source Version 0.0.3. Copyright 2016 Mike Bostock. | ||
(function (global, factory) { | ||
@@ -20,3 +20,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
function array(array) { | ||
return new ArraySource(array instanceof ArrayBuffer ? new Uint8Array(array) : array); | ||
return new ArraySource(array instanceof Uint8Array ? array : new Uint8Array(array)); | ||
} | ||
@@ -23,0 +23,0 @@ |
@@ -1,2 +0,2 @@ | ||
// https://github.com/mbostock/array-source Version 0.0.2. Copyright 2016 Mike Bostock. | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e.sources=e.sources||{},e.sources.array=r())}(this,function(){"use strict";function e(){return this._array=null,Promise.resolve()}function r(){var e=this._array;return this._array=null,Promise.resolve(e?{done:!1,value:e}:{done:!0,value:void 0})}function n(e){return new o(e instanceof ArrayBuffer?new Uint8Array(e):e)}function o(e){this._array=e}return o.prototype.read=r,o.prototype.cancel=e,n}); | ||
// https://github.com/mbostock/array-source Version 0.0.3. Copyright 2016 Mike Bostock. | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e.sources=e.sources||{},e.sources.array=r())}(this,function(){"use strict";function e(){return this._array=null,Promise.resolve()}function r(){var e=this._array;return this._array=null,Promise.resolve(e?{done:!1,value:e}:{done:!0,value:void 0})}function n(e){return new t(e instanceof Uint8Array?e:new Uint8Array(e))}function t(e){this._array=e}return t.prototype.read=r,t.prototype.cancel=e,n}); |
@@ -5,3 +5,3 @@ import array_cancel from "./cancel"; | ||
export default function array(array) { | ||
return new ArraySource(array instanceof ArrayBuffer ? new Uint8Array(array) : array); | ||
return new ArraySource(array instanceof Uint8Array ? array : new Uint8Array(array)); | ||
} | ||
@@ -8,0 +8,0 @@ |
{ | ||
"name": "array-source", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Read arrays as standard WhatWG streams.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -7,8 +7,10 @@ # array-source | ||
<a name="array" href="#array">#</a> <b>array</b>(<i>buffer</i>) [<>](https://github.com/mbostock/array-source/blob/master/index.js#L4 "Source") | ||
<br><a href="#slice">#</a> <b>slice</b>(<i>array</i>) | ||
<a name="array" href="#array">#</a> <b>array</b>(<i>array</i>) [<>](https://github.com/mbostock/array-source/blob/master/index.js#L4 "Source") | ||
<br><a href="#array">#</a> <b>array</b>(<i>length</i>) | ||
<br><a href="#array">#</a> <b>array</b>(<i>object</i>) | ||
<br><a href="#array">#</a> <b>array</b>(<i>buffer</i>) | ||
Returns a sliceable *source* for the specified [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array). | ||
Returns a sliceable *source* for the specified [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array). If the specified *array* is not a Uint8Array, it is passed to the Uint8Array constructor to create a new array; see the [TypedArray constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Syntax) for details. | ||
<a name="source_read" href="#source_read">#</a> <i>source</i>.<b>read</b>() [<>](https://github.com/mbostock/array-source/blob/master/slice/read.js "Source") | ||
<a name="source_read" href="#source_read">#</a> <i>source</i>.<b>read</b>() [<>](https://github.com/mbostock/array-source/blob/master/read.js "Source") | ||
@@ -20,4 +22,4 @@ Returns a Promise for the next chunk of data from the underlying stream. The yielded result is an object with the following properties: | ||
<a name="source_cancel" href="#source_cancel">#</a> <i>source</i>.<b>cancel</b>() [<>](https://github.com/mbostock/array-source/blob/master/slice/cancel.js "Source") | ||
<a name="source_cancel" href="#source_cancel">#</a> <i>source</i>.<b>cancel</b>() [<>](https://github.com/mbostock/array-source/blob/master/cancel.js "Source") | ||
Returns a Promise which is resolved when the underlying stream has been destroyed. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6124
24