This file contains hidden or 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
| export class EnumMap<E, T> { | |
| values: string[]; | |
| enum_: E; | |
| private constructor(enum_: E, mappings: EnumMap.Type<E, T>) { | |
| this.values = Object.keys(mappings); | |
| this.enum_ = enum_; | |
| return Object.assign(Object.create(this), mappings); | |
| } |
This file contains hidden or 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
| function splitWords(str: string) { | |
| return str.replace(/([a-z]|[A-Z]+)([A-Z]+$|[A-Z])/g, "$1 $2"); | |
| } |
This file contains hidden or 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
| export class EnumMap<E> { | |
| values: string[]; | |
| enum_: E; | |
| private constructor(enum_: E, mappings: EnumMap.Type<E>) { | |
| this.values = Object.keys(mappings); | |
| this.enum_ = enum_; | |
| return Object.assign(Object.create(this), mappings); | |
| } |
This file contains hidden or 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
| angular.module('crypto', []) | |
| .provider('crypto', function () { | |
| var crypto = window.crypto, subtle; | |
| if (!crypto || !(subtle = crypto.subtle || crypto.webkitSubtle)) { | |
| throw new Error('Web Cryptographic API not supported'); | |
| } | |
| var hashAlg = {name: 'SHA-1'}; | |
| var keyDerivationAlg = {name: 'PBKDF2', iterations: 500000, hash: hashAlg}; |
This file contains hidden or 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
| angular.module('configurators', ['ngRoute', 'ngMaterial']) | |
| .config(['$provide', '$routeProvider', 'Resolver', function ($provide, $routeProvider, Resolver) { | |
| var modules = {}; | |
| $provide.constant('RouteConfigurationProvider', function (module, options) { | |
| if (arguments.length === 1) { | |
| if (angular.isObject(module)) { | |
| options = module; |
This file contains hidden or 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
| /** | |
| * @method Array.prototype.groupBy(group) | |
| * Creates a dictionary grouping by an attribute or if `group` is a function, what it returns. | |
| * @param {function|string} group - attribute name or function(item, index, array): string | |
| * @returns {object.<array>} | |
| */ | |
| if (!Array.prototype.groupBy) { | |
| Object.defineProperty(Array.prototype, 'groupBy', { | |
| enumerable: false, | |
| value: function groupBy(group) { |
This file contains hidden or 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
| /** | |
| * Extends `obj` with properties created as `key: value` for every pair of two consecutive arguments | |
| * @param {Object} obj | |
| * @return {Object} obj | |
| */ | |
| function extendWithArgs(obj) { | |
| for (var i = 2; i < arguments.length; i += 2) { | |
| obj[arguments[i-1]] = arguments[i]; | |
| } | |
| return obj; |
This file contains hidden or 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
| angular.module('services-roles', []) | |
| .factory('HelperRole_CommonResourceGetter', function (params, errorHandler) { | |
| /** | |
| * @constructor | |
| * @param {string} name of the resource | |
| * @param {Resource} Resource | |
| * @param {Function.<Array|boolean>} actionArgsMapper | |
| */ |
This file contains hidden or 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
| angular.module('ng-attribute', []) | |
| // Horrible hack for obtaining directive class `Attribute` constructor function. | |
| // There is a nuisance in AngularJS in that the `constructor` property was not retained in the prototype. | |
| .directive('attributesDecorator', function () { | |
| // constructor extracted from angular.js | |
| function Attributes(element, attributesToCopy) { | |
| if (attributesToCopy) { | |
| var keys = Object.keys(attributesToCopy); | |
| var i, l, key; |
This file contains hidden or 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
| angular.module('$template-cache-watch', []) | |
| .decorator('$templateCache', function ($delegate) { | |
| var decorated = Object.create($delegate); | |
| var callbacks = Object.create(null); | |
| decorated.watch = function (key, callback) { | |
| if (!callbacks[key]) { | |
| callbacks[key] = []; |