| 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());
|
|
|