-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(identity): initial commit of function
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@import 'head'; | ||
|
||
/// A function that does nothing but return the parameter supplied to it. Good | ||
/// as a default or placeholder function. | ||
/// | ||
/// @group function | ||
/// @return {bool} true | ||
/// | ||
/// @example scss - indentity | ||
/// | ||
/// $is-one: identity(1); | ||
/// @debug $is-one; //=> 1 | ||
|
||
@function identity($args...) { | ||
@return head($args); | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@import 'true'; | ||
@import '../src/identity'; | ||
|
||
@include describe('identity [function]') { | ||
@include it('returns its first argument') { | ||
@include assert-equal(identity(null), null); | ||
@include assert-equal(identity('foo'), 'foo'); | ||
@include assert-equal(identity('foo', 'bar'), 'foo'); | ||
} | ||
} |