Is it good practice to replace short code that yields a boolean for use in conditionals with a function
<p>I have on several lines of code a conditional like this:</p>

<pre><code>if ( i &lt; DEVICES ) { .... some code
</code></pre>

<p>This code is repeated several times in my code, 15 times to be exact. 
The thing is that since this is repeated I created a function that replaces the validation:</p>

<pre><code>function isDevice(i) {return i &lt; DEVICES; }
</code></pre>

<p>And replaced all my conditionals with the function:</p>

<pre><code>if ( isDevice(i) ) { ... some code 
</code></pre>

<p>Now I am thinking, even though the code is repeated several times, is it really worth using the function? I am asking because it's more lines of code that I am using to abstract something that is repeated 15 times, but is a very simple validation.</p>