-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
968b09a
commit cbd875b
Showing
6 changed files
with
132 additions
and
166 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,2 +1,40 @@ | ||
'use strict'; | ||
var ngFameApp = angular.module('famous.angular', []); | ||
// 'use strict'; | ||
|
||
window.$famousUtils = function() { | ||
|
||
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; | ||
var MOZ_HACK_REGEXP = /^moz([A-Z])/; | ||
|
||
/** | ||
* Converts snake_case to camelCase. | ||
* Also there is special case for Moz prefix starting with upper case letter. | ||
* @param name Name to normalize | ||
*/ | ||
function camelCase(name) { | ||
return name. | ||
replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { | ||
return offset ? letter.toUpperCase() : letter; | ||
}). | ||
replace(MOZ_HACK_REGEXP, 'Moz$1'); | ||
} | ||
|
||
var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i; | ||
|
||
return { | ||
/** | ||
* @description Converts all accepted directives format into proper directive name. | ||
* All of these will become 'myDirective': | ||
* my:Directive | ||
* my-directive | ||
* x-my-directive | ||
* data-my:directive | ||
* | ||
* Also there is special case for Moz prefix starting with upper case letter. | ||
* @param name Name to normalize | ||
*/ | ||
directiveNormalize: function(name) { | ||
return camelCase(name.replace(PREFIX_REGEXP, '')); | ||
} | ||
}; | ||
}(); | ||
var ngFameApp = angular.module('famous.angular', ['ngTouch']); |
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 |
---|---|---|
|
@@ -206,4 +206,5 @@ ngFameApp.provider('$famous', function() { | |
|
||
return _modules; | ||
}; | ||
}); | ||
}); | ||
|