Skip to content

Commit

Permalink
fix: add helpers for ends with and includes helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
rajasegar committed Jun 13, 2020
1 parent b066675 commit 3ef66f5
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 57 deletions.
8 changes: 4 additions & 4 deletions addon/helpers/voca-ends-with.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { helper } from '@ember/component/helper';
import { endsWith } from 'voca';
import { helper } from "@ember/component/helper";
import { endsWith } from "voca";

export default helper(function vocaEndsWith(params/*, hash */ ) {
return endsWith(params[0], params[1]);
export default helper(function vocaEndsWith(params /*, hash */) {
return endsWith(params[0], params[1], params[2]);
});
8 changes: 4 additions & 4 deletions addon/helpers/voca-includes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { helper } from '@ember/component/helper';
import { includes } from 'voca';
import { helper } from "@ember/component/helper";
import { includes } from "voca";

export default helper(function vocaIncludes(params/*, hash */ ) {
return includes(params[0]);
export default helper(function vocaIncludes(params /*, hash */) {
return includes(params[0], params[1], params[2]);
});
38 changes: 28 additions & 10 deletions tests/dummy/app/templates/voca-ends-with.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@

<h3>voca-ends-with:</h3>
<p>Checks whether subject ends with end.</p>
<p>
<code>
<p>
<code>
\{{ voca-ends-with "red alert" "alert"}}
</code>
</p>
<p>
<code>
</code>
</p>
<p>
<code>
// => {{ voca-ends-with "red alert" "alert"}}

</code>
</p>
</code>
</p>
<p>
<code>
\{{ voca-ends-with "metro south" "metro"}}
</code>
</p>
<p>
<code>
// => {{ voca-ends-with "metro south" "metro"}}
</code>
</p>
<p>
<code>
\{{ voca-ends-with "Murphy" "ph" 5}}
</code>
</p>
<p>
<code>
// => {{ voca-ends-with "Murphy" "ph" 5}}
</code>
</p>
35 changes: 22 additions & 13 deletions tests/dummy/app/templates/voca-includes.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@

<h3>voca-includes:</h3>
<p>Description for voca-includes goes here.</p>
<p>
<code>
\{{ voca-includes "hello world"}}
</code>
</p>
<p>
<code>
// => {{ voca-includes "hello world"}}
</code>
</p>
<h3>voca-includes:</h3>
<p>Checks whether subject includes search starting from position.</p>
<p>
<code>
\{{ voca-includes "starship" "star"}}
</code>
</p>
<p>
<code>
// => {{ voca-includes "starship" "star"}}
</code>
</p>
<p>
<code>
\{{ voca-includes "galaxy" "g" 1}}
</code>
</p>
<p>
<code>
// => {{ voca-includes "galaxy" "g" 1}}
</code>
</p>
45 changes: 32 additions & 13 deletions tests/dummy/app/templates/voca-is-alpha-digit.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@

<h3>voca-is-alpha-digit:</h3>
<p>Description for voca-is-alpha-digit goes here.</p>
<p>
<code>
\{{ voca-is-alpha-digit "hello world"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha-digit "hello world"}}
</code>
</p>
<h3>voca-is-alpha-digit:</h3>
<p>Checks whether subject contains only alpha and digit characters</p>
<p>
<code>
\{{ voca-is-alpha-digit "year2020"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha-digit "year2020"}}
</code>
</p>
<p>
<code>
\{{ voca-is-alpha-digit "1448"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha-digit "1448"}}
</code>
</p>
<p>
<code>
\{{ voca-is-alpha-digit "40-20"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha-digit "40-20"}}
</code>
</p>
45 changes: 32 additions & 13 deletions tests/dummy/app/templates/voca-is-alpha.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@

<h3>voca-is-alpha:</h3>
<p>Description for voca-is-alpha goes here.</p>
<p>
<code>
\{{ voca-is-alpha "hello world"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha "hello world"}}
</code>
</p>
<h3>voca-is-alpha:</h3>
<p>Checks whether the parameter contains only alpha characters.</p>
<p>
<code>
\{{ voca-is-alpha "bart"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha "bart"}}
</code>
</p>
<p>
<code>
\{{ voca-is-alpha "lisa!"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha "lisa!"}}
</code>
</p>
<p>
<code>
\{{ voca-is-alpha "lisa and bart"}}
</code>
</p>
<p>
<code>
// => {{ voca-is-alpha "lisa and bart"}}
</code>
</p>

0 comments on commit 3ef66f5

Please sign in to comment.