code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function createResponse(status, data, headers, statusText) {
if (angular.isFunction(status)) return status;
return function() {
return angular.isNumber(status)
? [status, data, headers, statusText, 'complete']
: [200, status, data, headers, 'complete'];
};
} | General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
- passing through is disabled
- auto flushing is disabled
Returns instance for e2e testing (when `$delegate` and `$browser` specified):
- passing through (delegating request to real backend) is enable... | createResponse | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function $httpBackend(method, url, data, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) {
var xhr = new MockXhr(),
expectation = expectations[0],
wasExpected = false;
xhr.$$events = eventHandlers;
xhr.upload.$$events = uploadEventHandlers;
... | General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
- passing through is disabled
- auto flushing is disabled
Returns instance for e2e testing (when `$delegate` and `$browser` specified):
- passing through (delegating request to real backend) is enable... | $httpBackend | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function prettyPrint(data) {
return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp)
? data
: angular.toJson(data);
} | General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
- passing through is disabled
- auto flushing is disabled
Returns instance for e2e testing (when `$delegate` and `$browser` specified):
- passing through (delegating request to real backend) is enable... | prettyPrint | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function wrapResponse(wrapped) {
if (!$browser && timeout) {
if (timeout.then) {
timeout.then(function() {
handlePrematureEnd(angular.isDefined(timeout.$$timeoutId) ? 'timeout' : 'abort');
});
} else {
$timeout(function() {
handlePrematureEnd('... | General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
- passing through is disabled
- auto flushing is disabled
Returns instance for e2e testing (when `$delegate` and `$browser` specified):
- passing through (delegating request to real backend) is enable... | wrapResponse | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function handleResponse() {
var response = wrapped.response(method, url, data, headers, wrapped.params(url));
xhr.$$respHeaders = response[2];
callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
copy(response[3] || ''), copy(response[4]));
} | General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
- passing through is disabled
- auto flushing is disabled
Returns instance for e2e testing (when `$delegate` and `$browser` specified):
- passing through (delegating request to real backend) is enable... | handleResponse | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function handlePrematureEnd(reason) {
for (var i = 0, ii = responses.length; i < ii; i++) {
if (responses[i] === handleResponse) {
responses.splice(i, 1);
callback(-1, undefined, '', undefined, reason);
break;
}
}
} | General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
- passing through is disabled
- auto flushing is disabled
Returns instance for e2e testing (when `$delegate` and `$browser` specified):
- passing through (delegating request to real backend) is enable... | handlePrematureEnd | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function createFatalError(message) {
var error = new Error(message);
// In addition to being converted to a rejection, these errors also need to be passed to
// the $exceptionHandler and be rethrown (so that the test fails).
error.$$passToExceptionHandler = true;
return error;
} | General factory function for $httpBackend mock.
Returns instance for unit testing (when no arguments specified):
- passing through is disabled
- auto flushing is disabled
Returns instance for e2e testing (when `$delegate` and `$browser` specified):
- passing through (delegating request to real backend) is enable... | createFatalError | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function createShortMethods(prefix) {
angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) {
$httpBackend[prefix + method] = function(url, headers, keys) {
assertArgDefined(arguments, 0, 'url');
// Change url to `null` if `undefined` to stop it throwing an exception further dow... | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | createShortMethods | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function parseRouteUrl(url) {
var strippedUrl = stripQueryAndHash(url);
var parseOptions = {caseInsensitiveMatch: true, ignoreTrailingSlashes: true};
return routeToRegExp(strippedUrl, parseOptions);
} | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | parseRouteUrl | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function assertArgDefined(args, index, name) {
if (args.length > index && angular.isUndefined(args[index])) {
throw new Error('Undefined argument `' + name + '`; the argument is provided but not defined');
}
} | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | assertArgDefined | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function stripQueryAndHash(url) {
return url.replace(/[?#].*$/, '');
} | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | stripQueryAndHash | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function MockHttpExpectation(expectedMethod, expectedUrl, expectedData, expectedHeaders,
expectedKeys) {
this.data = expectedData;
this.headers = expectedHeaders;
this.match = function(method, url, data, headers) {
if (expectedMethod !== method) return false;
if (!this.match... | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | MockHttpExpectation | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function compareUrlWithQuery(url) {
var urlWithQueryRe = /^([^?]*)\?(.*)$/;
var expectedMatch = urlWithQueryRe.exec(expectedUrl);
var actualMatch = urlWithQueryRe.exec(url);
return !!(expectedMatch && actualMatch) &&
(expectedMatch[1] === actualMatch[1]) &&
(normalizeQuery(expectedMatch[2]... | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | compareUrlWithQuery | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function normalizeQuery(queryStr) {
return queryStr.split('&').sort().join('&');
} | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | normalizeQuery | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function extractParamsFromPath(strippedUrl) {
var keyObj = {};
if (!expectedUrl || !angular.isFunction(expectedUrl.test) ||
!expectedKeys || !expectedKeys.length) return keyObj;
var match = expectedUrl.exec(strippedUrl);
if (!match) return keyObj;
for (var i = 1, len = match.length; i < l... | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | extractParamsFromPath | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function extractParamsFromQuery(queryStr) {
var obj = {},
keyValuePairs = queryStr.split('&').
filter(angular.identity). // Ignore empty segments.
map(function(keyValue) { return keyValue.replace(/\+/g, '%20').split('='); });
angular.forEach(keyValuePairs, function(pair) {
... | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | extractParamsFromQuery | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function tryDecodeURIComponent(value) {
try {
return decodeURIComponent(value);
} catch (e) {
// Ignore any invalid uri component
}
} | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | tryDecodeURIComponent | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function createMockXhr() {
return new MockXhr();
} | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | createMockXhr | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function MockXhr() {
// hack for testing $http, $httpBackend
MockXhr.$$lastInstance = this;
this.open = function(method, url, async) {
this.$$method = method;
this.$$url = url;
this.$$async = async;
this.$$reqHeaders = {};
this.$$respHeaders = {};
};
this.send = function(data) {
thi... | @ngdoc method
@name $httpBackend#resetExpectations
@description
Resets all request expectations, but preserves all backend definitions. Typically, you would
call resetExpectations during a multiple-phase test when you want to reuse the same instance of
$httpBackend mock. | MockXhr | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
rafFn = function(fn) {
var index = rafFn.queue.length;
rafFn.queue.push(fn);
return function() {
rafFn.queue.splice(index, 1);
};
} | @ngdoc method
@name $timeout#verifyNoPendingTasks
@deprecated
sinceVersion="1.7.3"
This method takes all types of tasks (not only timeouts) into account, which is unintuitive.
It is recommended to use {@link ngMock.$verifyNoPendingTasks} instead, which additionally
allows checking for timeouts only (with `$verifyNoPe... | rafFn | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function createControllerDecorator() {
angular.mock.$ControllerDecorator = ['$delegate', function($delegate) {
return function(expression, locals, later, ident) {
if (later && typeof later === 'object') {
var instantiate = $delegate(expression, locals, true, ident);
var instance = instantiat... | @ngdoc service
@name $controller
@description
A decorator for {@link ng.$controller} with additional `bindings` parameter, useful when testing
controllers of directives that use {@link $compile#-bindtocontroller- `bindToController`}.
## Example
```js
// Directive definition ...
myMod.directive('myDirective', {
co... | createControllerDecorator | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function countChildScopes() {
var count = 0; // exclude the current scope
var pendingChildHeads = [this.$$childHead];
var currentScope;
while (pendingChildHeads.length) {
currentScope = pendingChildHeads.shift();
while (currentScope) {
count += 1;
pendingChildHeads.push(cur... | @ngdoc method
@name $rootScope.Scope#$countChildScopes
@module ngMock
@this $rootScope.Scope
@description
Counts all the direct and indirect child scopes of the current scope.
The current scope is excluded from the count. The count includes all isolate child scopes.
@returns {number} Total number of child scopes. | countChildScopes | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function countWatchers() {
var count = this.$$watchers ? this.$$watchers.length : 0; // include the current scope
var pendingChildHeads = [this.$$childHead];
var currentScope;
while (pendingChildHeads.length) {
currentScope = pendingChildHeads.shift();
while (currentScope) {
count ... | @ngdoc method
@name $rootScope.Scope#$countWatchers
@this $rootScope.Scope
@module ngMock
@description
Counts all the watchers of direct and indirect child scopes of the current scope.
The watchers of the current scope are included in the count and so are all the watchers of
isolate child scopes.
@returns {number} To... | countWatchers | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
wasInjectorCreated = function() {
return !!currentSpec;
} | @ngdoc method
@name $rootScope.Scope#$countWatchers
@this $rootScope.Scope
@module ngMock
@description
Counts all the watchers of direct and indirect child scopes of the current scope.
The watchers of the current scope are included in the count and so are all the watchers of
isolate child scopes.
@returns {number} To... | wasInjectorCreated | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function workFn() {
if (currentSpec.$injector) {
throw new Error('Injector already created, can not register a module!');
} else {
var fn, modules = currentSpec.$modules || (currentSpec.$modules = []);
angular.forEach(moduleFns, function(module) {
if (angular.isObject(modul... | @ngdoc function
@name angular.mock.module
@description
*NOTE*: This function is also published on window for easy access.<br>
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
This function registers a module configuration code. It collects the configuration information
which will be use... | workFn | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
ErrorAddingDeclarationLocationStack = function ErrorAddingDeclarationLocationStack(e, errorForStack) {
this.message = e.message;
this.name = e.name;
if (e.line) this.line = e.line;
if (e.sourceId) this.sourceId = e.sourceId;
if (e.stack && errorForStack)
this.stack = e.stack + '\n' + errorForS... | @ngdoc function
@name angular.mock.inject
@description
*NOTE*: This function is also published on window for easy access.<br>
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
The inject function wraps a function into an injectable function. The inject() creates new
instance of {@link au... | ErrorAddingDeclarationLocationStack | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function WorkFn() {
var modules = currentSpec.$modules || [];
var strictDi = !!currentSpec.$injectorStrict;
modules.unshift(['$injector', function($injector) {
currentSpec.$providerInjector = $injector;
}]);
modules.unshift('ngMock');
modules.unshift('ng');
var injector... | @ngdoc function
@name angular.mock.inject
@description
*NOTE*: This function is also published on window for easy access.<br>
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
The inject function wraps a function into an injectable function. The inject() creates new
instance of {@link au... | WorkFn | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function workFn() {
if (value !== currentSpec.$injectorStrict) {
if (currentSpec.$injector) {
throw new Error('Injector already created, can not modify strict annotations');
} else {
currentSpec.$injectorStrict = value;
}
}
} | @ngdoc function
@name angular.mock.inject
@description
*NOTE*: This function is also published on window for easy access.<br>
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
The inject function wraps a function into an injectable function. The inject() creates new
instance of {@link au... | workFn | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function InjectorState() {
this.shared = false;
this.sharedError = null;
this.cleanupAfterEach = function() {
return !this.shared || this.sharedError;
};
} | @ngdoc function
@name angular.mock.inject
@description
*NOTE*: This function is also published on window for easy access.<br>
*NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
The inject function wraps a function into an injectable function. The inject() creates new
instance of {@link au... | InjectorState | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function shallowClearAndCopy(src, dst) {
dst = dst || {};
angular.forEach(dst, function(value, key) {
delete dst[key];
});
for (var key in src) {
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = src[key];
}
}
return dst;
} | Create a shallow copy of an object and clear other fields from the destination | shallowClearAndCopy | javascript | angular/angular.js | src/ngResource/resource.js | https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js | MIT |
function inherit(parent, extra) {
return angular.extend(Object.create(parent), extra);
} | @ngdoc provider
@name $routeProvider
@this
@description
Used for configuring routes.
## Example
See {@link ngRoute.$route#examples $route} for an example of configuring and using `ngRoute`.
## Dependencies
Requires the {@link ngRoute `ngRoute`} module to be installed. | inherit | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function switchRouteMatcher(on, route) {
var keys = route.keys,
params = {};
if (!route.regexp) return null;
var m = route.regexp.exec(on);
if (!m) return null;
for (var i = 1, len = m.length; i < len; ++i) {
var key = keys[i - 1];
var val = m[i];
if ... | @param on {string} current url
@param route {Object} route regexp to match the url against
@return {?Object}
@description
Check if the route matches the current url.
Inspired by match in
visionmedia/express/lib/router/router.js. | switchRouteMatcher | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function prepareRoute($locationEvent) {
var lastRoute = $route.current;
preparedRoute = parseRoute();
preparedRouteIsUpdateOnly = isNavigationUpdateOnly(preparedRoute, lastRoute);
if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
if ($rootScope.$broadcast('$routeChangeS... | @param on {string} current url
@param route {Object} route regexp to match the url against
@return {?Object}
@description
Check if the route matches the current url.
Inspired by match in
visionmedia/express/lib/router/router.js. | prepareRoute | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function commitRoute() {
var lastRoute = $route.current;
var nextRoute = preparedRoute;
if (preparedRouteIsUpdateOnly) {
lastRoute.params = nextRoute.params;
angular.copy(lastRoute.params, $routeParams);
$rootScope.$broadcast('$routeUpdate', lastRoute);
} else if (nextRo... | @param on {string} current url
@param route {Object} route regexp to match the url against
@return {?Object}
@description
Check if the route matches the current url.
Inspired by match in
visionmedia/express/lib/router/router.js. | commitRoute | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function getRedirectionData(route) {
var data = {
route: route,
hasRedirection: false
};
if (route) {
if (route.redirectTo) {
if (angular.isString(route.redirectTo)) {
data.path = interpolate(route.redirectTo, route.params);
data.search = rout... | @param on {string} current url
@param route {Object} route regexp to match the url against
@return {?Object}
@description
Check if the route matches the current url.
Inspired by match in
visionmedia/express/lib/router/router.js. | getRedirectionData | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function handlePossibleRedirection(data) {
var keepProcessingRoute = true;
if (data.route !== $route.current) {
keepProcessingRoute = false;
} else if (data.hasRedirection) {
var oldUrl = $location.url();
var newUrl = data.url;
if (newUrl) {
$location.
... | @param on {string} current url
@param route {Object} route regexp to match the url against
@return {?Object}
@description
Check if the route matches the current url.
Inspired by match in
visionmedia/express/lib/router/router.js. | handlePossibleRedirection | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function resolveLocals(route) {
if (route) {
var locals = angular.extend({}, route.resolve);
angular.forEach(locals, function(value, key) {
locals[key] = angular.isString(value) ?
$injector.get(value) :
$injector.invoke(value, null, null, key);
});
... | @param on {string} current url
@param route {Object} route regexp to match the url against
@return {?Object}
@description
Check if the route matches the current url.
Inspired by match in
visionmedia/express/lib/router/router.js. | resolveLocals | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function getTemplateFor(route) {
var template, templateUrl;
if (angular.isDefined(template = route.template)) {
if (angular.isFunction(template)) {
template = template(route.params);
}
} else if (angular.isDefined(templateUrl = route.templateUrl)) {
if (angular.isFunc... | @param on {string} current url
@param route {Object} route regexp to match the url against
@return {?Object}
@description
Check if the route matches the current url.
Inspired by match in
visionmedia/express/lib/router/router.js. | getTemplateFor | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function parseRoute() {
// Match a route
var params, match;
angular.forEach(routes, function(route, path) {
if (!match && (params = switchRouteMatcher($location.path(), route))) {
match = inherit(route, {
params: angular.extend({}, $location.search(), params),
... | @returns {Object} the current active route, by matching it against the URL | parseRoute | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function isNavigationUpdateOnly(newRoute, oldRoute) {
// IF this is not a forced reload
return !forceReload
// AND both `newRoute`/`oldRoute` are defined
&& newRoute && oldRoute
// AND they map to the same Route Definition Object
&& (newRoute.$$route === oldRoute.$$ro... | @param {Object} newRoute - The new route configuration (as returned by `parseRoute()`).
@param {Object} oldRoute - The previous route configuration (as returned by `parseRoute()`).
@returns {boolean} Whether this is an "update-only" navigation, i.e. the URL maps to the same
route and it can be reused... | isNavigationUpdateOnly | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function interpolate(string, params) {
var result = [];
angular.forEach((string || '').split(':'), function(segment, i) {
if (i === 0) {
result.push(segment);
} else {
var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/);
var key = segmentMatch[1];
r... | @returns {string} interpolation of the redirect path with the parameters | interpolate | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function instantiateRoute($injector) {
if (isEagerInstantiationEnabled) {
// Instantiate `$route`
$injector.get('$route');
}
} | @returns {string} interpolation of the redirect path with the parameters | instantiateRoute | javascript | angular/angular.js | src/ngRoute/route.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js | MIT |
function $RouteParamsProvider() {
this.$get = function() { return {}; };
} | @ngdoc service
@name $routeParams
@requires $route
@this
@description
The `$routeParams` service allows you to retrieve the current set of route parameters.
Requires the {@link ngRoute `ngRoute`} module to be installed.
The route parameters are a combination of {@link ng.$location `$location`}'s
{@link ng.$location#... | $RouteParamsProvider | javascript | angular/angular.js | src/ngRoute/routeParams.js | https://github.com/angular/angular.js/blob/master/src/ngRoute/routeParams.js | MIT |
function $SanitizeProvider() {
var hasBeenInstantiated = false;
var svgEnabled = false;
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
hasBeenInstantiated = true;
if (svgEnabled) {
extend(validElements, svgElements);
}
return function(html) {
var buf = [];
htmlParser(ht... | @ngdoc provider
@name $sanitizeProvider
@this
@description
Creates and configures {@link $sanitize} instance. | $SanitizeProvider | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function isDOMParserAvailable() {
try {
return !!getInertBodyElement_DOMParser('');
} catch (e) {
return false;
}
} | Create an inert document that contains the dirty HTML that needs sanitizing.
We use the DOMParser API by default and fall back to createHTMLDocument if DOMParser is not
available. | isDOMParserAvailable | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function getInertBodyElement_DOMParser(html) {
// We add this dummy element to ensure that the rest of the content is parsed as expected
// e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the `<head>` tag.
html = '<remove></remove>' + html;
try {
var bo... | Create an inert document that contains the dirty HTML that needs sanitizing.
We use the DOMParser API by default and fall back to createHTMLDocument if DOMParser is not
available. | getInertBodyElement_DOMParser | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function getInertBodyElement_InertDocument(html) {
inertBodyElement.innerHTML = html;
// Support: IE 9-11 only
// strip custom-namespaced attributes on IE<=11
if (document.documentMode) {
stripCustomNsAttrs(inertBodyElement);
}
return inertBodyElement;
} | Create an inert document that contains the dirty HTML that needs sanitizing.
We use the DOMParser API by default and fall back to createHTMLDocument if DOMParser is not
available. | getInertBodyElement_InertDocument | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function htmlParserImpl(html, handler) {
if (html === null || html === undefined) {
html = '';
} else if (typeof html !== 'string') {
html = '' + html;
}
var inertBodyElement = getInertBodyElement(html);
if (!inertBodyElement) return '';
//mXSS protection
var mXSSAttempts = 5;
... | @example
htmlParser(htmlString, {
start: function(tag, attrs) {},
end: function(tag) {},
chars: function(text) {},
comment: function(text) {}
});
@param {string} html string
@param {object} handler | htmlParserImpl | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function attrToMap(attrs) {
var map = {};
for (var i = 0, ii = attrs.length; i < ii; i++) {
var attr = attrs[i];
map[attr.name] = attr.value;
}
return map;
} | @example
htmlParser(htmlString, {
start: function(tag, attrs) {},
end: function(tag) {},
chars: function(text) {},
comment: function(text) {}
});
@param {string} html string
@param {object} handler | attrToMap | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function encodeEntities(value) {
return value.
replace(/&/g, '&').
replace(SURROGATE_PAIR_REGEXP, function(value) {
var hi = value.charCodeAt(0);
var low = value.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
}).
replace(N... | Escapes all potentially dangerous characters, so that the
resulting string can be safely inserted into attribute or
element text.
@param value
@returns {string} escaped text | encodeEntities | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function htmlSanitizeWriterImpl(buf, uriValidator) {
var ignoreCurrentElement = false;
var out = bind(buf, buf.push);
return {
start: function(tag, attrs) {
tag = lowercase(tag);
if (!ignoreCurrentElement && blockedElements[tag]) {
ignoreCurrentElement = tag;
}
... | create an HTML/XML writer which writes to buffer
@param {Array} buf use buf.join('') to get out sanitized html string
@returns {object} in the form of {
start: function(tag, attrs) {},
end: function(tag) {},
chars: function(text) {},
comment: function(text) {}
} | htmlSanitizeWriterImpl | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function stripCustomNsAttrs(node) {
while (node) {
if (node.nodeType === window.Node.ELEMENT_NODE) {
var attrs = node.attributes;
for (var i = 0, l = attrs.length; i < l; i++) {
var attrNode = attrs[i];
var attrName = attrNode.name.toLowerCase();
if (attrName === ... | When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
to allow any of these custom attributes. This method strips them all.
@param node Root e... | stripCustomNsAttrs | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function getNonDescendant(propName, node) {
// An element is clobbered if its `propName` property points to one of its descendants
var nextNode = node[propName];
if (nextNode && nodeContains.call(node, nextNode)) {
throw $sanitizeMinErr('elclob', 'Failed to sanitize html because the element is clobber... | When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
to allow any of these custom attributes. This method strips them all.
@param node Root e... | getNonDescendant | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function sanitizeText(chars) {
var buf = [];
var writer = htmlSanitizeWriter(buf, noop);
writer.chars(chars);
return buf.join('');
} | When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
to allow any of these custom attributes. This method strips them all.
@param node Root e... | sanitizeText | javascript | angular/angular.js | src/ngSanitize/sanitize.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/sanitize.js | MIT |
function addText(text) {
if (!text) {
return;
}
html.push(sanitizeText(text));
} | @ngdoc filter
@name linky
@kind function
@description
Finds links in text input and turns them into html links. Supports `http/https/ftp/sftp/mailto` and
plain email address links.
Requires the {@link ngSanitize `ngSanitize`} module to be installed.
@param {string} text Input text.
@param {string} [target] Window (`... | addText | javascript | angular/angular.js | src/ngSanitize/filter/linky.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/filter/linky.js | MIT |
function addLink(url, text) {
var key, linkAttributes = attributesFn(url);
html.push('<a ');
for (key in linkAttributes) {
html.push(key + '="' + linkAttributes[key] + '" ');
}
if (isDefined(target) && !('target' in linkAttributes)) {
html.push('target="',
... | @ngdoc filter
@name linky
@kind function
@description
Finds links in text input and turns them into html links. Supports `http/https/ftp/sftp/mailto` and
plain email address links.
Requires the {@link ngSanitize `ngSanitize`} module to be installed.
@param {string} text Input text.
@param {string} [target] Window (`... | addLink | javascript | angular/angular.js | src/ngSanitize/filter/linky.js | https://github.com/angular/angular.js/blob/master/src/ngSanitize/filter/linky.js | MIT |
function getCoordinates(event) {
var originalEvent = event.originalEvent || event;
var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
var e = (originalEvent.changedTouches && originalEvent.changedTouches[0]) || touches[0];
return {
x: e.... | @ngdoc service
@name $swipe
@deprecated
sinceVersion="1.7.0"
See the {@link ngTouch module} documentation for more information.
@description
The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
behavior, to make implementing swipe-related directives more convenient.
Requires t... | getCoordinates | javascript | angular/angular.js | src/ngTouch/swipe.js | https://github.com/angular/angular.js/blob/master/src/ngTouch/swipe.js | MIT |
function getEvents(pointerTypes, eventType) {
var res = [];
angular.forEach(pointerTypes, function(pointerType) {
var eventName = POINTER_EVENTS[pointerType][eventType];
if (eventName) {
res.push(eventName);
}
});
return res.join(' ');
} | @ngdoc service
@name $swipe
@deprecated
sinceVersion="1.7.0"
See the {@link ngTouch module} documentation for more information.
@description
The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
behavior, to make implementing swipe-related directives more convenient.
Requires t... | getEvents | javascript | angular/angular.js | src/ngTouch/swipe.js | https://github.com/angular/angular.js/blob/master/src/ngTouch/swipe.js | MIT |
function nodeName_(element) {
return angular.$$lowercase(element.nodeName || (element[0] && element[0].nodeName));
} | @ngdoc module
@name ngTouch
@description
The `ngTouch` module provides helpers for touch-enabled devices.
The implementation is based on jQuery Mobile touch event handling
([jquerymobile.com](http://jquerymobile.com/)). *
See {@link ngTouch.$swipe `$swipe`} for usage.
@deprecated
sinceVersion="1.7.0"
The ngTouch mod... | nodeName_ | javascript | angular/angular.js | src/ngTouch/touch.js | https://github.com/angular/angular.js/blob/master/src/ngTouch/touch.js | MIT |
function makeSwipeDirective(directiveName, direction, eventName) {
ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {
// The maximum vertical delta for a swipe should be less than 75px.
var MAX_VERTICAL_DISTANCE = 75;
// Vertical distance should not be more than a fraction of... | @ngdoc directive
@name ngSwipeRight
@deprecated
sinceVersion="1.7.0"
See the {@link ngTouch module} documentation for more information.
@description
Specify custom behavior when an element is swiped to the right on a touchscreen device.
A rightward swipe is a quick, left-to-right slide of the finger.
Though ngSwipeR... | makeSwipeDirective | javascript | angular/angular.js | src/ngTouch/directive/ngSwipe.js | https://github.com/angular/angular.js/blob/master/src/ngTouch/directive/ngSwipe.js | MIT |
function validSwipe(coords) {
// Check that it's within the coordinates.
// Absolute vertical distance must be within tolerances.
// Horizontal distance, we take the current X - the starting X.
// This is negative for leftward swipes and positive for rightward swipes.
// After mu... | @ngdoc directive
@name ngSwipeRight
@deprecated
sinceVersion="1.7.0"
See the {@link ngTouch module} documentation for more information.
@description
Specify custom behavior when an element is swiped to the right on a touchscreen device.
A rightward swipe is a quick, left-to-right slide of the finger.
Though ngSwipeR... | validSwipe | javascript | angular/angular.js | src/ngTouch/directive/ngSwipe.js | https://github.com/angular/angular.js/blob/master/src/ngTouch/directive/ngSwipe.js | MIT |
function spyOnlyCallsWithArgs(obj, method) {
var originalFn = obj[method];
var spy = spyOn(obj, method);
obj[method] = function() {
if (arguments.length) return spy.apply(this, arguments);
return originalFn.apply(this);
};
return spy;
} | Create jasmine.Spy on given method, but ignore calls without arguments
This is helpful when need to spy only setter methods and ignore getters | spyOnlyCallsWithArgs | javascript | angular/angular.js | test/helpers/matchers.js | https://github.com/angular/angular.js/blob/master/test/helpers/matchers.js | MIT |
function createAsync(doneFn) {
function Job() {
this.next = [];
}
Job.prototype.done = function() {
return this.runs(doneFn);
};
Job.prototype.runs = function(fn) {
var newJob = new Job();
this.next.push(function() {
fn();
newJob.start();
});
return newJob;
};
Job.proto... | Create jasmine.Spy on given method, but ignore calls without arguments
This is helpful when need to spy only setter methods and ignore getters | createAsync | javascript | angular/angular.js | test/helpers/matchers.js | https://github.com/angular/angular.js/blob/master/test/helpers/matchers.js | MIT |
function Job() {
this.next = [];
} | Create jasmine.Spy on given method, but ignore calls without arguments
This is helpful when need to spy only setter methods and ignore getters | Job | javascript | angular/angular.js | test/helpers/matchers.js | https://github.com/angular/angular.js/blob/master/test/helpers/matchers.js | MIT |
function sortedHtml(element, showNgClass) {
var html = '';
forEach(jqLite(element), function toString(node) {
if (node.nodeName === '#text') {
html += node.nodeValue.
replace(/&(\w+[&;\W])?/g, function(match, entity) {return entity ? match : '&';}).
replace(/</g, '<').
repl... | @param {DOMElement} element
@param {boolean=} showNgClass | sortedHtml | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function childrenTagsOf(element) {
var tags = [];
forEach(jqLite(element).children(), function(child) {
tags.push(child.nodeName.toLowerCase());
});
return tags;
} | @param {DOMElement} element
@param {boolean=} showNgClass | childrenTagsOf | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function isCssVisible(node) {
var display = node.css('display');
return !node.hasClass('ng-hide') && display !== 'none';
} | a
This method is a cheap way of testing if css for a given node is not set to 'none'. It doesn't
actually test if an element is displayed by the browser. Be aware!!! | isCssVisible | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function assertHidden(node) {
if (isCssVisible(node)) {
throw new Error('Node should be hidden but was visible: ' + angular.mock.dump(node));
}
} | a
This method is a cheap way of testing if css for a given node is not set to 'none'. It doesn't
actually test if an element is displayed by the browser. Be aware!!! | assertHidden | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function assertVisible(node) {
if (!isCssVisible(node)) {
throw new Error('Node should be visible but was hidden: ' + angular.mock.dump(node));
}
} | a
This method is a cheap way of testing if css for a given node is not set to 'none'. It doesn't
actually test if an element is displayed by the browser. Be aware!!! | assertVisible | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function provideLog($provide) {
$provide.factory('log', function() {
var messages = [];
function log(msg) {
messages.push(msg);
return msg;
}
log.toString = function() {
return messages.join('; ');
};
log.toArray = function() {
return messages;
... | a
This method is a cheap way of testing if css for a given node is not set to 'none'. It doesn't
actually test if an element is displayed by the browser. Be aware!!! | provideLog | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function log(msg) {
messages.push(msg);
return msg;
} | a
This method is a cheap way of testing if css for a given node is not set to 'none'. It doesn't
actually test if an element is displayed by the browser. Be aware!!! | log | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function trace(name) {
window.dump(new Error(name).stack);
} | a
This method is a cheap way of testing if css for a given node is not set to 'none'. It doesn't
actually test if an element is displayed by the browser. Be aware!!! | trace | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function generateInputCompilerHelper(helper) {
beforeEach(function() {
helper.validationCounter = {};
module(function($compileProvider) {
$compileProvider.directive('validationSpy', function() {
return {
priority: 1,
require: 'ngModel',
link: function(scope, elemen... | a
This method is a cheap way of testing if css for a given node is not set to 'none'. It doesn't
actually test if an element is displayed by the browser. Be aware!!! | generateInputCompilerHelper | javascript | angular/angular.js | test/helpers/testabilityPatch.js | https://github.com/angular/angular.js/blob/master/test/helpers/testabilityPatch.js | MIT |
function _argToString(arg) {
return (typeof arg === 'object' && !(isError(arg))) ? toJson(arg) : '' + arg;
} | http://wiki.commonjs.org/wiki/Promises
http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
Q: https://github.com/kriskowal/q
https://github.com/kriskowal/q/blob/master/design/README.js
https://github.com/kriskowal/uncommonjs/b... | _argToString | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function _argumentsToString(args) {
return sliceArgs(args).map(_argToString).join(',');
} | http://wiki.commonjs.org/wiki/Promises
http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
Q: https://github.com/kriskowal/q
https://github.com/kriskowal/q/blob/master/design/README.js
https://github.com/kriskowal/uncommonjs/b... | _argumentsToString | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function _logInvocation(funcName, args, returnVal, throwReturnVal) {
var logPrefix = funcName + '(' + _argumentsToString(args) + ')';
if (throwReturnVal) {
log.push(logPrefix + '->throw(' + _argToString(returnVal) + ')');
throw returnVal;
} else {
if (isUndefined(returnVal)) {
lo... | http://wiki.commonjs.org/wiki/Promises
http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
Q: https://github.com/kriskowal/q
https://github.com/kriskowal/q/blob/master/design/README.js
https://github.com/kriskowal/uncommonjs/b... | _logInvocation | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function success(name, returnVal, throwReturnVal) {
var returnValDefined = (arguments.length >= 2);
name = 'success' + (name || '');
return function() {
return _logInvocation(name, arguments, (returnValDefined ? returnVal : arguments[0]), throwReturnVal);
};
} | Creates a callback that logs its invocation in `log`.
@param {(number|string)} name Suffix for 'success' name. e.g. success(1) => success1
@param {*=} returnVal Value that the callback should return. If unspecified, the passed in
value is returned.
@param {boolean=} throwReturnVal If true, the `returnVal` will be ... | success | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function fin(name, returnVal, throwReturnVal) {
var returnValDefined = (arguments.length >= 2);
name = 'finally' + (name || '');
return function() {
return _logInvocation(name, arguments, (returnValDefined ? returnVal : arguments[0]), throwReturnVal);
};
} | Creates a callback that logs its invocation in `log`.
@param {(number|string)} name Suffix for 'finally' name. e.g. finally(1) => finally
@param {*=} returnVal Value that the callback should return. If unspecified, the passed in
value is returned.
@param {boolean=} throwReturnVal If true, the `returnVal` will be t... | fin | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function progress(name, returnVal, throwReturnVal) {
var returnValDefined = (arguments.length >= 2);
name = 'progress' + (name || '');
return function() {
return _logInvocation(name, arguments, (returnValDefined ? returnVal : arguments[0]), throwReturnVal);
};
} | Creates a callback that logs its invocation in `log`.
@param {(number|string)} name Suffix for 'progress' name. e.g. progress(1) => progress
@param {*=} returnVal Value that the callback should return. If unspecified, the passed in
value is returned.
@param {boolean=} throwReturnVal If true, the `returnVal` will b... | progress | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function error(name, returnVal, throwReturnVal) {
var returnValDefined = (arguments.length >= 2);
name = 'error' + (name || '');
return function() {
if (!returnValDefined) {
_logInvocation(name, arguments, 'reject(' + _argToString(arguments[0]) + ')', throwReturnVal);
return q.reject(a... | Creates a callback that logs its invocation in `log`.
@param {(number|string)} name Suffix for 'error' name. e.g. error(1) => error
@param {*=} returnVal Value that the callback should return. If unspecified, the passed in
value is first passed to q.reject() and the result is returned.
@param {boolean=} throwRetur... | error | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function syncResolve(deferred, result) {
deferred.resolve(result);
mockNextTick.flush();
} | helper for synchronous resolution of deferred | syncResolve | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function syncReject(deferred, reason) {
deferred.reject(reason);
mockNextTick.flush();
} | helper for synchronous rejection of deferred | syncReject | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function syncNotify(deferred, progress) {
deferred.notify(progress);
mockNextTick.flush();
} | helper for synchronous notification of deferred | syncNotify | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function logStr() {
return log.join('; ');
} | converts the `log` to a '; '-separated string | logStr | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
function exceptionHandler(exception, reason) {
if (typeof reason === 'undefined') {
exceptionHandlerCalls.push({ reason: exception });
} else {
exceptionHandlerCalls.push({ reason: reason, exception: exception });
}
} | converts the `log` to a '; '-separated string | exceptionHandler | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
createPromise = function() {
return q(function(resolveFn, rejectFn) {
if (resolve === null) {
resolve = resolveFn;
reject = rejectFn;
} else if (resolve2 === null) {
resolve2 = resolveFn;
reject2 = rejectFn;
}
});
} | converts the `log` to a '; '-separated string | createPromise | javascript | angular/angular.js | test/ng/qSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/qSpec.js | MIT |
getSelectedOriginal = function(option) {
return originalSelectedDescriptor.get.call(option);
} | This behavior is broken and should probably be cleaned up later as track by and select as
aren't compatible. | getSelectedOriginal | javascript | angular/angular.js | test/ng/directive/ngOptionsSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/directive/ngOptionsSpec.js | MIT |
setSelectedOriginal = function(option, value) {
originalSelectedDescriptor.set.call(option, value);
} | This behavior is broken and should probably be cleaned up later as track by and select as
aren't compatible. | setSelectedOriginal | javascript | angular/angular.js | test/ng/directive/ngOptionsSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/directive/ngOptionsSpec.js | MIT |
getIndexAndCall = function(option, foundFn, notFoundFn, value) {
for (var i = 0, ii = options.length; i < ii; ++i) {
if (options[i] === option) return foundFn(i, value);
}
return notFoundFn(option, value);
} | This behavior is broken and should probably be cleaned up later as track by and select as
aren't compatible. | getIndexAndCall | javascript | angular/angular.js | test/ng/directive/ngOptionsSpec.js | https://github.com/angular/angular.js/blob/master/test/ng/directive/ngOptionsSpec.js | MIT |
init( debug, assert, silent ) {
this.debug = debug;
this.assert = assert;
this.silent = silent;
this.msgs = require('./msg').errors;
return this;
} | Error handler for HackMyResume. All errors are handled here.
@class ErrorHandler | init | javascript | hacksalot/HackMyResume | src/cli/error.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/error.js | MIT |
err( ex, shouldExit ) {
// Short-circuit logging output if --silent is on
let stack;
const o = this.silent ? function() {} : _defaultLog;
// Special case; can probably be removed.
if (ex.pass) { throw ex; }
// Load error messages
this.msgs = this.msgs || require('./msg').errors;
// H... | Error handler for HackMyResume. All errors are handled here.
@class ErrorHandler | err | javascript | hacksalot/HackMyResume | src/cli/error.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/error.js | MIT |
format_error( msg ) {
msg = msg || '';
return chalk.red.bold( msg.toUpperCase().startsWith('ERROR:') ? msg : `Error: ${msg}` );
} | Error handler for HackMyResume. All errors are handled here.
@class ErrorHandler | format_error | javascript | hacksalot/HackMyResume | src/cli/error.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/error.js | MIT |
format_warning( brief, msg ) {
return chalk.yellow(brief) + chalk.yellow(msg || '');
} | Error handler for HackMyResume. All errors are handled here.
@class ErrorHandler | format_warning | javascript | hacksalot/HackMyResume | src/cli/error.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/error.js | MIT |
assembleError = function( ex ) {
let se;
let msg = '';
let withStack = false;
let quit = false;
let etype = 'warning';
if (this.debug) { withStack = true; }
switch (ex.fluenterror) {
case HMSTATUS.themeNotFound:
msg = printf( M2C( this.msgs.themeNotFound.msg, 'yellow' ), ex.data);
break... | Error handler for HackMyResume. All errors are handled here.
@class ErrorHandler | assembleError | javascript | hacksalot/HackMyResume | src/cli/error.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/error.js | MIT |
init(opts) {
this.opts = EXTEND( true, this.opts || { }, opts );
this.msgs = YAML.load(PATH.join( __dirname, 'msg.yml' )).events;
} | A stateful output module. All HMR console output handled here. | init | javascript | hacksalot/HackMyResume | src/cli/out.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/out.js | MIT |
log() {
printf = require('printf');
const finished = printf.apply( printf, arguments );
return this.opts.silent || console.log( finished ); // eslint-disable-line no-console
} | A stateful output module. All HMR console output handled here. | log | javascript | hacksalot/HackMyResume | src/cli/out.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/out.js | MIT |
do( evt ) {
const that = this;
const L = function() { return that.log.apply( that, arguments ); };
switch (evt.sub) {
case HME.begin:
return this.opts.debug &&
L( M2C( this.msgs.begin.msg, dbgStyle), evt.cmd.toUpperCase() );
//when HME.beforeCreate
//L( M2C( this.msgs... | A stateful output module. All HMR console output handled here. | do | javascript | hacksalot/HackMyResume | src/cli/out.js | https://github.com/hacksalot/HackMyResume/blob/master/src/cli/out.js | MIT |
constructor(dt) {
this.rep = this.fmt(dt);
} | Create a FluentDate from a string or Moment date object. There are a few date
formats to be aware of here.
1. The words "Present" and "Now", referring to the current date
2. The default "YYYY-MM-DD" format used in JSON Resume ("2015-02-10")
3. Year-and-month only ("2015-04")
4. Year-only "YYYY" ("2015")
5. The friendly... | constructor | javascript | hacksalot/HackMyResume | src/core/fluent-date.js | https://github.com/hacksalot/HackMyResume/blob/master/src/core/fluent-date.js | MIT |
static isCurrent(dt) {
return !dt || (String.is(dt) && /^(present|now|current)$/.test(dt));
} | Create a FluentDate from a string or Moment date object. There are a few date
formats to be aware of here.
1. The words "Present" and "Now", referring to the current date
2. The default "YYYY-MM-DD" format used in JSON Resume ("2015-02-10")
3. Year-and-month only ("2015-04")
4. Year-only "YYYY" ("2015")
5. The friendly... | isCurrent | javascript | hacksalot/HackMyResume | src/core/fluent-date.js | https://github.com/hacksalot/HackMyResume/blob/master/src/core/fluent-date.js | MIT |
parse( stringData, opts ) {
this.imp = this.imp != null ? this.imp : {raw: stringData};
return this.parseJSON(JSON.parse( stringData ), opts);
} | Initialize the the FreshResume from JSON string data. | parse | javascript | hacksalot/HackMyResume | src/core/fresh-resume.js | https://github.com/hacksalot/HackMyResume/blob/master/src/core/fresh-resume.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.