This repository was archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Make src/util pass the linter #68
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5908aaa
Automated liting fixes to the files in src/util.
slashrsm 0bc856e
Make src/util/buffer.js comply with the style guide.
slashrsm 6490ba0
Make src/util/js.js comply with the style guide.
slashrsm 1be5748
Make src/util/preconditions.js comply with the style guide.
slashrsm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,30 @@ | ||
| 'use strict'; | ||
|
|
||
| var errors = require('../errors'); | ||
| var _ = require('lodash'); | ||
| const _ = require('lodash'); | ||
| const buffer = require('buffer'); | ||
| const errors = require('../errors'); | ||
|
|
||
| module.exports = { | ||
| checkState: function(condition, message) { | ||
| checkState(condition, message) { | ||
| if (!condition) { | ||
| throw new errors.InvalidState(message); | ||
| } | ||
| }, | ||
| checkArgument: function(condition, argumentName, message, docsPath) { | ||
| checkArgument(condition, argumentName, message, docsPath) { | ||
| if (!condition) { | ||
| throw new errors.InvalidArgument(argumentName, message, docsPath); | ||
| } | ||
| }, | ||
| checkArgumentType: function(argument, type, argumentName) { | ||
| checkArgumentType(argument, type, argumentName) { | ||
| argumentName = argumentName || '(unknown name)'; | ||
| if (_.isString(type)) { | ||
| if (type === 'Buffer') { | ||
| var buffer = require('buffer'); // './buffer' fails on cordova & RN | ||
| if (!buffer.Buffer.isBuffer(argument)) { | ||
| throw new errors.InvalidArgumentType(argument, type, argumentName); | ||
| } | ||
| } else if (typeof argument !== type) { | ||
| } else if (typeof argument !== type) { // eslint-disable-line valid-typeof | ||
| throw new errors.InvalidArgumentType(argument, type, argumentName); | ||
| } | ||
| } else { | ||
| if (!(argument instanceof type)) { | ||
| throw new errors.InvalidArgumentType(argument, type.name, argumentName); | ||
| } | ||
| } else if (!(argument instanceof type)) { | ||
| throw new errors.InvalidArgumentType(argument, type.name, argumentName); | ||
| } | ||
| } | ||
| }, | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probaby try to refactor this? It is used allo over the place so it will break everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe we can create a new pull request so that we fix all instances of this issue at once. We can talk on Monday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up #70