Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: third_party/pkg/angular/lib/utils.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/utils.dart
===================================================================
--- third_party/pkg/angular/lib/utils.dart (revision 33054)
+++ third_party/pkg/angular/lib/utils.dart (working copy)
@@ -1,6 +1,6 @@
library angular.util;
-bool toBool(x) {
+toBool(x) {
if (x is bool) return x;
if (x is num) return x != 0;
return false;
@@ -44,12 +44,6 @@
if (fn is FnWith0Args) return (_1) => fn();
}
-relaxFnArgs2(Function fn) {
- if (fn is FnWith2Args) return fn;
- if (fn is FnWith1Args) return (_1, _2) => fn(_1);
- if (fn is FnWith0Args) return (_1, _2) => fn();
-}
-
relaxFnArgs3(Function fn) {
if (fn is FnWith3Args) return fn;
if (fn is FnWith2Args) return (_1, _2, _3) => fn(_1, null);
@@ -77,44 +71,18 @@
}
}
+camelcase(String s) {
+ var part = s.split('-').map((s) => s.toLowerCase());
+ if (part.length <= 1) {
+ return part.join();
+ }
+ return part.first + part.skip(1).map(capitalize).join();
+}
+
capitalize(String s) => s.substring(0, 1).toUpperCase() + s.substring(1);
+var SNAKE_CASE_REGEXP = new RegExp("[A-Z]");
-/// Returns whether or not the given identifier is a reserved word in Dart.
-bool isReservedWord(String identifier) => RESERVED_WORDS.contains(identifier);
-
-final Set<String> RESERVED_WORDS = new Set<String>.from(const [
- "assert",
- "break",
- "case",
- "catch",
- "class",
- "const",
- "continue",
- "default",
- "do",
- "else",
- "enum",
- "extends",
- "false",
- "final",
- "finally",
- "for",
- "if",
- "in",
- "is",
- "new",
- "null",
- "rethrow",
- "return",
- "super",
- "switch",
- "this",
- "throw",
- "true",
- "try",
- "var",
- "void",
- "while",
- "with"
-]);
+snakecase(String name, [separator = '-']) =>
+ name.replaceAllMapped(SNAKE_CASE_REGEXP, (Match match) =>
+ (match.start != 0 ? separator : '') + match.group(0).toLowerCase());
« no previous file with comments | « third_party/pkg/angular/lib/tools/template_cache_generator.dart ('k') | third_party/pkg/angular/package.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698