Skip to content

remove unneeded condition #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2018
Merged

remove unneeded condition #16

merged 1 commit into from
Feb 17, 2018

Conversation

asfktz
Copy link

@asfktz asfktz commented Feb 15, 2018

Since arrify already returns the value as is in case its an array, this condition might be unnecessary:
https://github.com/olstenlarck/is-async-function/blob/master/index.js#L59

names = Array.isArray(names) ? names : arrayify(names)

// same as

names = arrayify(names)

arrify source:
https://github.com/sindresorhus/arrify/blob/master/index.js

'use strict';
module.exports = function (val) {
	if (val === null || val === undefined) {
		return [];
	}

	return Array.isArray(val) ? val : [val];
};

@codecov-io
Copy link

codecov-io commented Feb 15, 2018

Codecov Report

Merging #16 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #16   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          14     14           
=====================================
  Hits           14     14
Impacted Files Coverage Δ
index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 103cf28...3baaf02. Read the comment docs.

@tunnckoCore
Copy link
Collaborator

Yea, i know.. It was just to skip the calling of arrayify function... some paranoid optimization 🤣

Thanks for the PR anyway!
Cool, addition can be to add check if fn is '[object AsyncFunction]'

@asfktz
Copy link
Author

asfktz commented Feb 16, 2018

Hmm.. haven't thought of that 😄

@tunnckoCore tunnckoCore merged commit a4d5b41 into inspect-js:master Feb 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants