Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Throw if fs start arg is not number #2780

Closed

Conversation

coolaj86
Copy link

closing issues #2554 and #2567

@@ -1038,8 +1038,13 @@ var ReadStream = fs.ReadStream = function(path, options) {
if (this.encoding) this.setEncoding(this.encoding);

if (this.start !== undefined) {
if ('number' !== typeof this.start) {
throw TypeError("'start' must be a Number or left undefined, not a string containing a number");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor beans, but I think the "left" should be removed (sounds a little better IMO), as well as "not a string containing a number" (you're not sure that this is the case, what if it's an Object of some sort?)

@TooTallNate
Copy link

I'm not sure if this is something we care about but this would break for anyone passing around a new Number() object (I don't know of anybody doing that though).

@isaacs
Copy link

isaacs commented Feb 18, 2012

I agree with @TooTallNate. Message should just be "'start' must be a Number".

Passing around new Number objects is not supported, so the conditional is fine.

Otherwise LGTM.

@isaacs
Copy link

isaacs commented Feb 27, 2012

Landed on 7f58d20. Thanks!

@isaacs isaacs closed this Feb 27, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants