type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
currTok =>
tokenLabel(currTok) | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
ArrowFunction |
currtok =>
tokenLabel(currtok) | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
ArrowFunction |
currRule => currRule.name | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildMismatchTokenMessage({
expected,
actual,
previous,
ruleName
}): string {
let hasLabel = hasTokenLabel(expected)
let expectedMsg = hasLabel
? `--> ${tokenLabel(expected)} <--`
: `token of type --> ${expected.name} <--`
let msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`
return msg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildNotAllInputParsedMessage({ firstRedundant, ruleName }): string {
return (
"Redundant input, expecting EOF but found: " + firstRedundant.image
)
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildNoViableAltMessage({
expectedPathsPerAlt,
actual,
previous,
customUserDescription,
ruleName
}): string {
let errPrefix = "Expecting: "
// TODO: issue: No Viable Alternative Error may have incomplete details. #502
let actualText = first(actual).image
let errSuffix = "\nbut found: '" + actualText + "'"
if (customUserDescription) {
return errPrefix + customUserDescription + errSuffix
} else {
let allLookAheadPaths = reduce(
expectedPathsPerAlt,
(result, currAltPaths) => result.concat(currAltPaths),
[]
)
let nextValidTokenSequences = map(
allLookAheadPaths,
currPath =>
`[${map(currPath, currTokenType =>
tokenLabel(currTokenType)
).join(", ")}]`
)
let nextValidSequenceItems = map(
nextValidTokenSequences,
(itemMsg, idx) => ` ${idx + 1}. ${itemMsg}`
)
let calculatedDescription = `one of these possible Token sequences:\n${nextValidSequenceItems.join(
"\n"
)}`
return errPrefix + calculatedDescription + errSuffix
}
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildEarlyExitMessage({
expectedIterationPaths,
actual,
customUserDescription,
ruleName
}): string {
let errPrefix = "Expecting: "
// TODO: issue: No Viable Alternative Error may have incomplete details. #502
let actualText = first(actual).image
let errSuffix = "\nbut found: '" + actualText + "'"
if (customUserDescription) {
return errPrefix + customUserDescription + errSuffix
} else {
let nextValidTokenSequences = map(
expectedIterationPaths,
currPath =>
`[${map(currPath, currTokenType =>
tokenLabel(currTokenType)
).join(",")}]`
)
let calculatedDescription =
`expecting at least one iteration which starts with one of these possible Token sequences::\n ` +
`<${nextValidTokenSequences.join(" ,")}>`
return errPrefix + calculatedDescription + errSuffix
}
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildRuleNotFoundError(
topLevelRule: Rule,
undefinedRule: NonTerminal
): string {
const msg =
"Invalid grammar, reference to a rule which is not defined: ->" +
undefinedRule.nonTerminalName +
"<-\n" +
"inside top level rule: ->" +
topLevelRule.name +
"<-"
return msg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildDuplicateFoundError(
topLevelRule: Rule,
duplicateProds: IProductionWithOccurrence[]
): string {
function getExtraProductionArgument(
prod: IProductionWithOccurrence
): string {
if (prod instanceof Terminal) {
return prod.terminalType.name
} else if (prod instanceof NonTerminal) {
return prod.nonTerminalName
} else {
return ""
}
}
const topLevelName = topLevelRule.name
const duplicateProd = first(duplicateProds)
const index = duplicateProd.idx
const dslName = getProductionDslName(duplicateProd)
let extraArgument = getExtraProductionArgument(duplicateProd)
const hasExplicitIndex = index > 0
let msg = `->${dslName}${hasExplicitIndex ? index : ""}<- ${
extraArgument ? `with argument: ->${extraArgument}<-` : ""
}
appears more than once (${
duplicateProds.length
} times) in the top level rule: ->${topLevelName}<-.
For further details see: https://sap.github.io/chevrotain/docs/FAQ.html#NUMERICAL_SUFFIXES
`
// white space trimming time! better to trim afterwards as it allows to use WELL formatted multi line template strings...
msg = msg.replace(/[ \t]+/g, " ")
msg = msg.replace(/\s\s+/g, "\n")
return msg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildInvalidNestedRuleNameError(
topLevelRule: Rule,
nestedProd: IOptionallyNamedProduction
): string {
const msg =
`Invalid nested rule name: ->${nestedProd.name}<- inside rule: ->${topLevelRule.name}<-\n` +
`it must match the pattern: ->${validNestedRuleName.toString()}<-.\n` +
`Note that this means a nested rule name must start with the '$'(dollar) sign.`
return msg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildDuplicateNestedRuleNameError(
topLevelRule: Rule,
nestedProd: IOptionallyNamedProduction[]
): string {
const duplicateName = first(nestedProd).name
const errMsg =
`Duplicate nested rule name: ->${duplicateName}<- inside rule: ->${topLevelRule.name}<-\n` +
`A nested name must be unique in the scope of a top level grammar rule.`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildNamespaceConflictError(rule: Rule): string {
const errMsg =
`Namespace conflict found in grammar.\n` +
`The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.name}>.\n` +
`To resolve this make sure each Terminal and Non-Terminal names are unique\n` +
`This is easy to accomplish by using the convention that Terminal names start with an uppercase letter\n` +
`and Non-Terminal names start with a lower case letter.`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildAlternationPrefixAmbiguityError(options: {
topLevelRule: Rule
prefixPath: TokenType[]
ambiguityIndices: number[]
alternation: Alternation
}): string {
const pathMsg = map(options.prefixPath, currTok =>
tokenLabel(currTok)
).join(", ")
const occurrence =
options.alternation.idx === 0 ? "" : options.alternation.idx
const errMsg =
`Ambiguous alternatives: <${options.ambiguityIndices.join(
" ,"
)}> due to common lookahead prefix\n` +
`in <OR${occurrence}> inside <${options.topLevelRule.name}> Rule,\n` +
`<${pathMsg}> may appears as a prefix path in all these alternatives.\n` +
`See: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\n` +
`For Further details.`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildAlternationAmbiguityError(options: {
topLevelRule: Rule
prefixPath: TokenType[]
ambiguityIndices: number[]
alternation: Alternation
}): string {
let pathMsg = map(options.prefixPath, currtok =>
tokenLabel(currtok)
).join(", ")
let occurrence =
options.alternation.idx === 0 ? "" : options.alternation.idx
let currMessage =
`Ambiguous Alternatives Detected: <${options.ambiguityIndices.join(
" ,"
)}> in <OR${occurrence}>` +
` inside <${options.topLevelRule.name}> Rule,\n` +
`<${pathMsg}> may appears as a prefix path in all these alternatives.\n`
currMessage =
currMessage +
`See: https://sap.github.io/chevrotain/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\n` +
`For Further details.`
return currMessage
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildEmptyRepetitionError(options: {
topLevelRule: Rule
repetition: IProductionWithOccurrence
}): string {
let dslName = getProductionDslName(options.repetition)
if (options.repetition.idx !== 0) {
dslName += options.repetition.idx
}
const errMsg =
`The repetition <${dslName}> within Rule <${options.topLevelRule.name}> can never consume any tokens.\n` +
`This could lead to an infinite loop.`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildTokenNameError(options: {
tokenType: TokenType
expectedPattern: RegExp
}): string {
const tokTypeName = options.tokenType.name
const errMsg = `Invalid Grammar Token name: ->${tokTypeName}<- it must match the pattern: ->${options.expectedPattern.toString()}<-`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildEmptyAlternationError(options: {
topLevelRule: Rule
alternation: Alternation
emptyChoiceIdx: number
}): string {
const errMsg =
`Ambiguous empty alternative: <${options.emptyChoiceIdx + 1}>` +
` in <OR${options.alternation.idx}> inside <${options.topLevelRule.name}> Rule.\n` +
`Only the last alternative may be an empty alternative.`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildTooManyAlternativesError(options: {
topLevelRule: Rule
alternation: Alternation
}): string {
const errMsg =
`An Alternation cannot have more than 256 alternatives:\n` +
`<OR${options.alternation.idx}> inside <${
options.topLevelRule.name
}> Rule.\n has ${options.alternation.definition.length +
1} alternatives.`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildLeftRecursionError(options: {
topLevelRule: Rule
leftRecursionPath: Rule[]
}): string {
const ruleName = options.topLevelRule.name
let pathNames = utils.map(
options.leftRecursionPath,
currRule => currRule.name
)
let leftRecursivePath = `${ruleName} --> ${pathNames
.concat([ruleName])
.join(" --> ")}`
let errMsg =
`Left Recursion found in grammar.\n` +
`rule: <${ruleName}> can be invoked from itself (directly or indirectly)\n` +
`without consuming any Tokens. The grammar path that causes this is: \n ${leftRecursivePath}\n` +
` To fix this refactor your grammar to remove the left recursion.\n` +
`see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildInvalidRuleNameError(options: {
topLevelRule: Rule
expectedPattern: RegExp
}): string {
const ruleName = options.topLevelRule.name
const expectedPatternString = options.expectedPattern.toString()
const errMsg = `Invalid grammar rule name: ->${ruleName}<- it must match the pattern: ->${expectedPatternString}<-`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
MethodDeclaration |
buildDuplicateRuleNameError(options: {
topLevelRule: Rule | string
grammarName: string
}): string {
let ruleName
if (options.topLevelRule instanceof Rule) {
ruleName = options.topLevelRule.name
} else {
ruleName = options.topLevelRule
}
const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options.grammarName}<-`
return errMsg
} | Hocdoc/chevrotain | packages/chevrotain/src/parse/errors_public.ts | TypeScript |
FunctionDeclaration |
function calculatePrizeForTierPercentage(
tierIndex: number,
tierValue: BigNumberish,
bitRangeSize: number,
prizeAmount: BigNumber
): BigNumber {
const numberOfPrizes = calculateNumberOfPrizesForTierIndex(
bitRangeSize,
tierIndex
);
const fractionOfPrize = calculateFractionOfPrize(numberOfPrizes, tierValue);
let expectedPrizeAmount: BigNumber = prizeAmount.mul(fractionOfPrize);
expectedPrizeAmount = expectedPrizeAmount.div(
BigNumber.from('1000000000000000000')
);
return expectedPrizeAmount;
} | pooltogether/v4-js | src/calculate/calculatePrizeForTierPercentage.ts | TypeScript |
InterfaceDeclaration |
export interface IQuoteRequestRejectNoQuoteQualifiers {
QuoteQualifier?: string;
} | pvtienhoa/jspurefix | dist/types/FIXFXCM/quickfix/set/quote_request_reject_no_quote_qualifiers.d.ts | TypeScript |
ArrowFunction |
(appendToObject: JQuery) => {
var textNode: Text = document.createTextNode(this.text);
if(this.style){
var newSpan: HTMLSpanElement = document.createElement('span');
if(this.style.getFont()) newSpan.style.font = this.style.getFont();
if(this.style.getFontSize() != null) newSpan.style.fontSize = this.style.getFontSize() + "pt";
if(this.style.getUnderline() != null) newSpan.style.textDecoration='underline';
if(this.style.getColor()) newSpan.style.color = this.style.getColor();
if(this.style.getMarginTop()) newSpan.style.marginTop = this.style.getMarginTop() + "px";
if(this.style.getMarginBottom()) newSpan.style.marginBottom = this.style.getMarginBottom() + "px";
if(this.style.getMarginLeft()) newSpan.style.marginLeft = this.style.getMarginLeft() + "px";
if(this.style.getMarginRight()) newSpan.style.marginRight = this.style.getMarginRight() + "px";
newSpan.appendChild(textNode);
appendToObject.append(newSpan);
} else {
var newSpan: HTMLSpanElement = document.createElement('span');
//appendToObject.append(textNode);
newSpan.appendChild(textNode);
appendToObject.append(newSpan);
}
} | A-Hilaly/deeplearning4j | deeplearning4j-ui-parent/deeplearning4j-ui-components/src/main/typescript/org/deeplearning4j/ui/components/text/ComponentText.ts | TypeScript |
ClassDeclaration | /*
*
* * Copyright 2016 Skymind,Inc.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/
/// <reference path="../../api/Component.ts" />
/// <reference path="../../api/Margin.ts" />
/// <reference path="../../util/TSUtils.ts" />
class ComponentText extends Component implements Renderable {
private text: string;
private style: StyleText;
constructor(jsonStr: string){
super(ComponentType.ComponentText);
var json = JSON.parse(jsonStr);
if(!json["componentType"]) json = json[ComponentType[ComponentType.ComponentText]];
this.text = json['text'];
if(json['style']) this.style = new StyleText(json['style']);
}
render = (appendToObject: JQuery) => {
var textNode: Text = document.createTextNode(this.text);
if(this.style){
var newSpan: HTMLSpanElement = document.createElement('span');
if(this.style.getFont()) newSpan.style.font = this.style.getFont();
if(this.style.getFontSize() != null) newSpan.style.fontSize = this.style.getFontSize() + "pt";
if(this.style.getUnderline() != null) newSpan.style.textDecoration='underline';
if(this.style.getColor()) newSpan.style.color = this.style.getColor();
if(this.style.getMarginTop()) newSpan.style.marginTop = this.style.getMarginTop() + "px";
if(this.style.getMarginBottom()) newSpan.style.marginBottom = this.style.getMarginBottom() + "px";
if(this.style.getMarginLeft()) newSpan.style.marginLeft = this.style.getMarginLeft() + "px";
if(this.style.getMarginRight()) newSpan.style.marginRight = this.style.getMarginRight() + "px";
newSpan.appendChild(textNode);
appendToObject.append(newSpan);
} else {
var newSpan: HTMLSpanElement = document.createElement('span');
//appendToObject.append(textNode);
newSpan.appendChild(textNode);
appendToObject.append(newSpan);
}
}
} | A-Hilaly/deeplearning4j | deeplearning4j-ui-parent/deeplearning4j-ui-components/src/main/typescript/org/deeplearning4j/ui/components/text/ComponentText.ts | TypeScript |
FunctionDeclaration |
function formatResponse(
response: LedgerEntryResponse
): FormattedPaymentChannel {
if (response.node === undefined ||
response.node.LedgerEntryType !== 'PayChannel') {
throw new NotFoundError('Payment channel ledger entry not found')
}
return parsePaymentChannel(response.node)
} | alexchiriac/ripple-lib | src/ledger/payment-channel.ts | TypeScript |
FunctionDeclaration |
async function getPaymentChannel(
this: RippleAPI, id: string
): Promise<FormattedPaymentChannel> {
// 1. Validate
validate.getPaymentChannel({id})
// 2. Make Request
const response = await this.request('ledger_entry', {
index: id,
binary: false,
ledger_index: 'validated'
})
// 3. Return Formatted Response
return formatResponse(response)
} | alexchiriac/ripple-lib | src/ledger/payment-channel.ts | TypeScript |
ArrowFunction |
() => {
it("should return 4 space indentation correctly", () => {
const result = getDefaultIndentation(true, 4);
expect(result).to.equal(" ");
});
it("should return 2 space indentation correctly", () => {
const result = getDefaultIndentation(true, 2);
expect(result).to.equal(" ");
});
it("should return tab indentation correctly", () => {
let result = getDefaultIndentation(false, 4);
expect(result).to.equal("\t");
result = getDefaultIndentation(false, 8);
expect(result).to.equal("\t");
});
} | 1021ky/autoDocstring | src/test/parse/utilities.spec.ts | TypeScript |
ArrowFunction |
() => {
const result = getDefaultIndentation(true, 4);
expect(result).to.equal(" ");
} | 1021ky/autoDocstring | src/test/parse/utilities.spec.ts | TypeScript |
ArrowFunction |
() => {
const result = getDefaultIndentation(true, 2);
expect(result).to.equal(" ");
} | 1021ky/autoDocstring | src/test/parse/utilities.spec.ts | TypeScript |
ArrowFunction |
() => {
let result = getDefaultIndentation(false, 4);
expect(result).to.equal("\t");
result = getDefaultIndentation(false, 8);
expect(result).to.equal("\t");
} | 1021ky/autoDocstring | src/test/parse/utilities.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should trim lines passed.', () => {
const result = preprocessLines([
' foo ',
'\t\tbar\t\t',
'\r\rbatz\r\r',
'\t\rhello\t\r',
'\t\t \r\t world\t\r \r\t '
]);
expect(result).to.be.deep.equal([
'foo',
'bar',
'batz',
'hello',
'world'
]);
});
it('should discard comments.', () => {
const result = preprocessLines([
'foo',
'# hello world'
]);
expect(result).to.be.deep.equal([
'foo'
]);
});
} | 1021ky/autoDocstring | src/test/parse/utilities.spec.ts | TypeScript |
ArrowFunction |
() => {
const result = preprocessLines([
' foo ',
'\t\tbar\t\t',
'\r\rbatz\r\r',
'\t\rhello\t\r',
'\t\t \r\t world\t\r \r\t '
]);
expect(result).to.be.deep.equal([
'foo',
'bar',
'batz',
'hello',
'world'
]);
} | 1021ky/autoDocstring | src/test/parse/utilities.spec.ts | TypeScript |
ArrowFunction |
() => {
const result = preprocessLines([
'foo',
'# hello world'
]);
expect(result).to.be.deep.equal([
'foo'
]);
} | 1021ky/autoDocstring | src/test/parse/utilities.spec.ts | TypeScript |
ArrowFunction |
() => this.settings.getServers(definition.private) | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
ArrowFunction |
(x) => ({
pattern: new RegExp(x.pattern),
key: x.key,
value: x.value
}) | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
ArrowFunction |
(x) => x.pattern.test(file.filePath) | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
InterfaceDeclaration | /**
* Data that is provided to the templates to generate a link.
*/
interface UrlData {
/**
* The base URL of the server.
*/
readonly base: string;
/**
* The path to the repository on the server.
*/
readonly repository: string;
/**
* The type of link being generated.
*/
readonly type: 'branch' | 'commit';
/**
* The Git ref to generate the link to. This will be a branch name or commit hash depending on the link type.
*/
readonly ref: string;
/**
* The hash of the current commit.
*/
readonly commit: string;
/**
* The file to generate the link for.
*/
readonly file: string;
/**
* The one-based line number of the start of the selection, if a selection is being included in the link.
*/
readonly startLine?: number;
/**
* The one-based column number of the start of the selection, if a selection is being included in the link.
*/
readonly startColumn?: number;
/**
* The one-based line number of the end of the selection, if a selection is being included in the link.
*/
readonly endLine?: number;
/**
* The one-based column number of the end of the selection, if a selection is being included in the link.
*/
readonly endColumn?: number;
/**
* Additional handler-specific settings.
*/
[settingsKey: string]: unknown;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
InterfaceDeclaration |
interface FileData {
readonly match: RegExpMatchArray;
readonly http?: string;
readonly ssh?: string;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
InterfaceDeclaration | /**
* The parsed query modification for making modifications to the URL's query string.
*/
export interface ParsedQueryModification {
/**
* The regular expression to match against the file name.
*/
readonly pattern: RegExp;
/**
* The key to add to the query string when the pattern matches.
*/
readonly key: string;
/**
* The value to add to the query string when the pattern matches.
*/
readonly value: string;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
InterfaceDeclaration | /**
* The parsed settings for getting file information from a URL.
*/
interface ParsedReverseSettings {
/**
* The regular expression pattern to match against the URL.
*/
readonly pattern: RegExp;
/**
* The template to produce a file name.
*/
readonly file: ParsedTemplate;
/**
* The templates that provide the base remote URLs.
*/
readonly server: ParsedTemplates<ReverseServerSettings>;
/**
* The templates that provide the selection range.
*/
readonly selection: ParsedTemplates<ReverseSelectionSettings>;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
TypeAliasDeclaration | /**
* Parsed templates.
*/
type ParsedTemplates<T> = { [K in keyof T]: ParsedTemplate }; | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Determines whether this handler can generate links for the given remote URL.
*
* @param remoteUrl The remote URL to check.
* @returns True if this handler handles the given remote URL; otherwise, false.
*/
public isMatch(remoteUrl: string): boolean {
return this.server.match(normalizeUrl(remoteUrl)) !== undefined;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Creates a link for the specified file.
*
* @param repository The repository that the file is in.
* @param file The details of the file.
* @param options The options for creating the link.
* @returns The URL.
*/
public async createUrl(
repository: RepositoryWithRemote,
file: FileInfo,
options: LinkOptions
): Promise<string> {
let remote: string;
let address: StaticServer;
let type: LinkType;
let url: string;
let data: UrlData;
// If a link type wasn't specified, then we'll use
// the default type that's defined in the settings.
type = options.type ?? this.settings.getDefaultLinkType();
// Adjust the remote URL so that it's in a
// standard format that we can manipulate.
remote = normalizeUrl(repository.remote.url);
address = this.getAddress(remote);
data = {
base: address.http,
repository: this.getRepositoryPath(remote, address),
ref: await this.getRef(type, repository),
commit: await this.getRef('commit', repository),
file: await this.getRelativePath(repository.root, file.filePath),
type: type === 'commit' ? 'commit' : 'branch',
...file.selection
};
if (this.settingsKeys) {
for (let key of this.settingsKeys) {
data[key] = this.settings.getHandlerSetting(key);
}
}
url = this.urlTemplate.render(data);
if (file.selection) {
url += this.selectionTemplate.render(data);
}
url = this.applyModifications(
url,
this.queryModifications.filter((x) => x.pattern.test(file.filePath))
);
return url;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Applies the given query string modifications to the URL.
*
* @param url The URL to modify.
* @param modifications The modifications to apply.
* @returns The modified URL.
*/
private applyModifications(url: string, modifications: ParsedQueryModification[]): string {
if (modifications.length > 0) {
let u: URL;
u = new URL(url);
for (let modification of modifications) {
u.searchParams.append(modification.key, modification.value);
}
url = u.toString();
}
return url;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Gets the server address for the given remote URL.
*
* @param remote The remote URL.
* @returns The server address.
*/
private getAddress(remote: string): StaticServer {
let address: StaticServer | undefined;
address = this.server.match(remote);
if (!address) {
throw new Error('Could not find a matching address.');
}
return this.normalizeServerUrls(address);
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Normalizes the server URLs to make them consistent for use in the templates.
*
* @param address The server address to normalize.
* @returns The normalized server URLs.
*/
private normalizeServerUrls(address: StaticServer): StaticServer {
let http: string;
let ssh: string | undefined;
http = normalizeUrl(address.http);
ssh = address.ssh ? normalizeUrl(address.ssh) : undefined;
return { http, ssh };
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Gets the path to the repository at the given server address.
*
* @param remoteUrl The remote URL of the repository.
* @param address The address of the server.
* @returns The path to the repository.
*/
private getRepositoryPath(remoteUrl: string, address: StaticServer): string {
let repositoryPath: string;
// Remove the server's address from the start of the URL.
// Note that the remote URL and both URLs in the server
// address have been normalized by this point.
if (remoteUrl.startsWith(address.http)) {
repositoryPath = remoteUrl.substring(address.http.length);
} else {
repositoryPath = address.ssh ? remoteUrl.substring(address.ssh.length) : '';
}
// The server address we matched against may not have ended
// with a slash (for HTTPS paths) or a colon (for SSH paths),
// which means the path might start with that. Trim that off now.
if (repositoryPath.length > 0) {
if (repositoryPath[0] === '/' || repositoryPath[0] === ':') {
repositoryPath = repositoryPath.substring(1);
}
}
if (repositoryPath.endsWith('.git')) {
repositoryPath = repositoryPath.substring(0, repositoryPath.length - 4);
}
return repositoryPath;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Gets the ref to use when creating the link.
*
* @param type The type of ref to get.
* @param repository The repository.
* @returns The ref to use.
*/
private async getRef(type: LinkType, repository: RepositoryWithRemote): Promise<string> {
switch (type) {
case 'branch':
return (
await git(
repository.root,
'rev-parse',
this.getRevParseOutputArgument(),
'HEAD'
)
).trim();
case 'commit':
return (await git(repository.root, 'rev-parse', 'HEAD')).trim();
default:
// Use the default branch if one is specified in the settings; otherwise find the
// name of the default branch by getting the name of the "remote_name/HEAD" ref.
return (
this.settings.getDefaultBranch() ||
(await this.getDefaultRemoteBranch(repository))
);
}
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Gets the name of the default branch in the remote.
*
* @param repository The repository.
* @returns The name of the default branch.
*/
private async getDefaultRemoteBranch(repository: RepositoryWithRemote): Promise<string> {
let branch: string;
try {
branch = (
await git(
repository.root,
'rev-parse',
this.getRevParseOutputArgument(),
`${repository.remote.name}/HEAD`
)
).trim();
} catch (ex) {
throw new NoRemoteHeadError(getErrorMessage(ex));
}
switch (this.definition.branchRef) {
case 'abbreviated':
// The branch name will be "remote_name/branch_name",
// but we only want the "branch_name" part.
return branch.slice(repository.remote.name.length + 1);
case 'symbolic':
// The branch name will be "refs/remotes/remote_name/branch_name",
// but we want it to be "refs/heads/branch_name".
return branch.replace(
new RegExp(`^refs\\/remotes\\/${this.escapeRegExp(repository.remote.name)}\\/`),
'refs/heads/'
);
default:
return branch;
}
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Escapes a value that can then be used in a Regular Expression.
*
* @param value The value to escape.
* @returns The escaped value.
*/
private escapeRegExp(value: string): string {
return value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Gets the argument to use with `git rev-parse` to specify the output.
*
* @returns The argument to use.
*/
private getRevParseOutputArgument(): string {
switch (this.definition.branchRef) {
case 'symbolic':
return '--symbolic-full-name';
default:
return '--abbrev-ref';
}
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Gets the relative path from the specified directory to the specified file.
*
* @param from The directory to get the relative path from.
* @param to The file to get the relative path to.
* @returns The relative path of the file.
*/
private async getRelativePath(from: string, to: string): Promise<string> {
// If the file is a symbolic link, or is under a directory that's a
// symbolic link, then we want to resolve the path to the real file
// because the sybmolic link won't be in the Git repository.
if (await this.isSymbolicLink(to, from)) {
try {
to = await fs.realpath(to);
// Getting the real path of the file resolves all symbolic links,
// which means if the repository is also under a symbolic link,
// then the new file path may no longer be under the root directory.
// We can fix this by also getting the real path of the root directory.
from = await fs.realpath(from);
} catch (ex) {
// Provide a nicer error message that
// explains what we were trying to do.
throw new Error(
`Unable to resolve the symbolic link '${to}' to a real path.\n${getErrorMessage(
ex
)}`
);
}
}
// Get the relative path, then normalize
// the separators to forward slashes.
return path.relative(from, to).replace(/\\/g, '/');
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Determines whether the specified file is a symbolic link.
*
* @param filePath The path of the file to check.
* @param rootDirectory The path to the root of the repository.
* @returns True if the specified file is a symbolic link within the repository; otherwise, false.
*/
private async isSymbolicLink(filePath: string, rootDirectory: string): Promise<boolean> {
// Check if the file is a symbolic link. If it isn't, then walk up
// the tree to see if an ancestor directory is a symbolic link. Keep
// stepping up until we reach the root directory of the repository,
// because we only need to resolve symbolic links within the repository.
// If the entire repository is under a symbolic link, then we don't
// want to resolve paths to somewhere outside the repository.
while (filePath !== rootDirectory) {
let stats: Stats;
let parent: string;
try {
stats = await fs.lstat(filePath);
} catch (ex) {
// Assume that the path isn't a symbolic link.
return false;
}
if (stats.isSymbolicLink()) {
return true;
}
parent = path.dirname(filePath);
if (parent === filePath) {
// We can't go any higher, so the
// path cannot be a symbolic link.
return false;
}
filePath = parent;
}
return false;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Gets information about the given URL.
*
* @param url The URL to get the information from.
* @param strict Whether to require the URL to match the server address of the handler.
* @returns The URL information, or `undefined` if the information could not be determined.
*/
public getUrlInfo(url: string, strict: boolean): UrlInfo | undefined {
let address: StaticServer | undefined;
let match: RegExpExecArray | null;
// See if the URL matches the server address for the handler.
address = this.server.match(url);
// If we are performing a strict match, then the
// URL must match to this handler's server.
if (strict && !address) {
return undefined;
}
if (address) {
address = this.normalizeServerUrls(address);
}
match = this.reverse.pattern.exec(url);
if (match) {
let data: FileData;
let file: string;
let server: StaticServer;
let selection: Partial<SelectedRange>;
data = {
match,
http: address?.http,
ssh: address?.ssh
};
file = this.reverse.file.render(data);
server = {
http: this.reverse.server.http.render(data),
ssh: this.reverse.server.ssh.render(data)
};
selection = {
startLine: this.tryParseNumber(this.reverse.selection.startLine.render(data)),
endLine: this.tryParseNumber(this.reverse.selection.endLine?.render(data)),
startColumn: this.tryParseNumber(this.reverse.selection.startColumn?.render(data)),
endColumn: this.tryParseNumber(this.reverse.selection.endColumn?.render(data))
};
return { filePath: file, server, selection };
}
return undefined;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
MethodDeclaration | /**
* Attempts to parse the given value to a number.
*
* @param value The value to parse.
* @returns The value as a number, or `undefined` if the value could not be parsed.
*/
private tryParseNumber(value: string | undefined): number | undefined {
if (value !== undefined) {
let num: number;
num = parseInt(value, 10);
if (!isNaN(num)) {
return num;
}
}
return undefined;
} | reduckted/GitWebLinks | vscode/src/link-handler.ts | TypeScript |
ArrowFunction |
aPath => path.join(assetPath, aPath) | devcode1981/vscode-appcelerator-titanium | src/providers/completion/alloyAutoCompleteRules.ts | TypeScript |
ArrowFunction |
item => path.basename(item.path) !== '.DS_Store' | devcode1981/vscode-appcelerator-titanium | src/providers/completion/alloyAutoCompleteRules.ts | TypeScript |
ArrowFunction |
img => (img.prefix === prefix && img.suffix === suffix) | devcode1981/vscode-appcelerator-titanium | src/providers/completion/alloyAutoCompleteRules.ts | TypeScript |
InterfaceDeclaration |
interface AlloyAutoCompleteRule {
regExp: RegExp;
getCompletions: (range?: Range) => Promise<CompletionItem[]>|CompletionItem[];
requireRange?: boolean;
rangeRegex?: RegExp;
} | devcode1981/vscode-appcelerator-titanium | src/providers/completion/alloyAutoCompleteRules.ts | TypeScript |
MethodDeclaration |
async getCompletions () {
const cfgPath = path.join(utils.getAlloyRootPath(), 'config.json');
const completions: CompletionItem[] = [];
if (utils.fileExists(cfgPath)) {
const document = await workspace.openTextDocument(cfgPath);
const cfgObj = JSON.parse(document.getText());
const deconstructedConfig = {};
for (const [ key, value ] of Object.entries(cfgObj)) {
if (key === 'global' || key.startsWith('os:') || key.startsWith('env:')) {
// Ignore and traverse
Object.assign(deconstructedConfig, value);
}
}
const allKeys = utils.getAllKeys(deconstructedConfig);
for (const key of allKeys) {
completions.push({
label: key,
kind: CompletionItemKind.Value
});
}
}
return completions;
} | devcode1981/vscode-appcelerator-titanium | src/providers/completion/alloyAutoCompleteRules.ts | TypeScript |
MethodDeclaration |
async getCompletions () {
const defaultLang = ExtensionContainer.config.project.defaultI18nLanguage;
const i18nPath = utils.getI18nPath();
const completions: CompletionItem[] = [];
if (utils.directoryExists(i18nPath)) {
const i18nStringPath = path.join(i18nPath, defaultLang, 'strings.xml');
if (utils.fileExists(i18nStringPath)) {
const document = await workspace.openTextDocument(i18nStringPath);
const result = await parseXmlString(document.getText()) as { resources: { string: { $: { name: string }; _: string }[] } };
if (result && result.resources && result.resources.string) {
for (const value of result.resources.string) {
completions.push({
label: value.$.name,
kind: CompletionItemKind.Reference,
detail: value._
});
}
}
}
}
return completions;
} | devcode1981/vscode-appcelerator-titanium | src/providers/completion/alloyAutoCompleteRules.ts | TypeScript |
MethodDeclaration |
getCompletions (range) {
const alloyRootPath = utils.getAlloyRootPath();
const assetPath = path.join(alloyRootPath, 'assets');
const completions: CompletionItem[] = [];
// limit search to these sub-directories
let paths = [ 'images', 'iphone', 'android', 'windows' ];
paths = paths.map(aPath => path.join(assetPath, aPath));
for (const imgPath of paths) {
if (!utils.directoryExists(imgPath)) {
continue;
}
const files = walkSync(imgPath, {
nodir: true,
filter: item => path.basename(item.path) !== '.DS_Store'
});
const images = [];
for (const file of files) {
let prefix: string|undefined;
let scale: string|undefined;
let suffix: string|undefined;
// test whether image is includes scaling factor (for iOS)
let matches = file.path.match(/(^[\w\s\\/\-_():]+)(@[\w~]+)(.\w+$)/);
if (matches && matches.length === 4) {
prefix = matches[1];
scale = matches[2];
suffix = matches[3];
} else {
matches = file.path.match(/(^[\w\s/\\\-_():]+)(.\w+$)/);
if (matches && matches.length === 3) {
prefix = matches[1];
scale = '@1x';
suffix = matches[2];
}
}
if (prefix && suffix && scale) {
const image = images.find(img => (img.prefix === prefix && img.suffix === suffix));
if (image) {
image.scales.push(scale);
} else {
images.push({
prefix,
suffix,
file: file.path,
scales: [ scale ]
});
}
}
}
for (const image of images) {
let scales;
if (!(image.scales.length === 1 && image.scales[0] === '@1x')) {
scales = image.scales.join(', ');
}
// TODO: Is it possible to preview the image like the atom plugin? We do this elsewhere right now
completions.push({
label: utils.toUnixPath(`${image.prefix}${image.suffix}`.replace(assetPath, '')).replace(/^\/(iphone|android|windows)/, ''),
kind: CompletionItemKind.File,
range,
detail: scales
});
}
}
return completions;
} | devcode1981/vscode-appcelerator-titanium | src/providers/completion/alloyAutoCompleteRules.ts | TypeScript |
ClassDeclaration |
@Component({
tag: 'arcgis-expand',
styleUrl: 'arcgis-expand.css',
shadow: false,
})
export class ArcGISSearch {
@Element() el: HTMLDivElement;
@Prop() position: string;
@Prop() view : __esri.MapView | __esri.SceneView;
@Prop({ mutable: true }) widget: any;
@Watch('view')
validateView(value: __esri.MapView) {
if (value) {
this.widget.view = value;
this.widget.view.ui.add(this.el, this.position);
}
}
@Event() loaded: EventEmitter<boolean>;
componentWillLoad() {
const expand = new Expand({
container: this.el
});
this.widget = expand;
this.loaded.emit(true);
}
componentDidRender() {
const elems = Array.from(this.el.children);
for (let e of elems) {
if (e.tagName.toLowerCase().includes('arcgis-')) {
(e as any).view = this.view;
this.widget.content = e;
this.widget.expandIconClass = (e as any).widget.iconClass;
}
}
}
} | odoe/arcgis-comps | src/components/arcgis-expand/arcgis-expand.tsx | TypeScript |
MethodDeclaration |
@Watch('view')
validateView(value: __esri.MapView) {
if (value) {
this.widget.view = value;
this.widget.view.ui.add(this.el, this.position);
}
} | odoe/arcgis-comps | src/components/arcgis-expand/arcgis-expand.tsx | TypeScript |
MethodDeclaration |
componentWillLoad() {
const expand = new Expand({
container: this.el
});
this.widget = expand;
this.loaded.emit(true);
} | odoe/arcgis-comps | src/components/arcgis-expand/arcgis-expand.tsx | TypeScript |
MethodDeclaration |
componentDidRender() {
const elems = Array.from(this.el.children);
for (let e of elems) {
if (e.tagName.toLowerCase().includes('arcgis-')) {
(e as any).view = this.view;
this.widget.content = e;
this.widget.expandIconClass = (e as any).widget.iconClass;
}
}
} | odoe/arcgis-comps | src/components/arcgis-expand/arcgis-expand.tsx | TypeScript |
InterfaceDeclaration |
export interface IStrapiModelAttribute {
unique?: boolean;
required?: boolean;
type?: StrapiType;
default?: string | number | boolean;
dominant?: boolean;
collection?: string;
model?: string;
via?: string;
plugin?: string;
enum?: string[];
component?: string;
components?: string[];
repeatable?: boolean;
} | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
InterfaceDeclaration |
export interface IStrapiModel {
/** Not from Strapi, but is the filename on disk */
_filename: string;
_isComponent?: boolean;
connection: string;
collectionName: string;
info: {
name: string;
description: string;
icon?: string;
};
options?: {
timestamps: boolean;
};
attributes: { [attr: string]: IStrapiModelAttribute };
} | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
InterfaceDeclaration |
export interface IStrapiModelExtended extends IStrapiModel {
// use to output filename
ouputFile: string;
// interface name
interfaceName: string;
// model name extract from *.(settings|schema).json filename. Use to link model.
modelName: string;
} | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
InterfaceDeclaration |
export interface IStrapi4ModelAttribute {
type?: Strapi4AttributeType;
relation?: Strapi4RelationType;
target?: string;
mappedBy?: string;
inversedBy?: string;
repeatable?: boolean;
component?: string;
components?: string[];
required?: boolean;
max?: number;
min?: number;
minLength?: number;
maxLength?: number;
private?: boolean;
configurable?: boolean;
targetField?: string;
options?: string;
default?: string | number | boolean;
unique?: boolean;
enum?: string[];
} | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
InterfaceDeclaration |
export interface IStrapi4Model {
/** Not from Strapi, but is the filename on disk */
_filename: string;
_isComponent?: boolean;
kind: 'collectionType' | 'singleType',
tableName: string;
info: {
displayName: string;
singularName: string;
pluralName: string;
description: string;
icon: string;
};
options?: {
privateAttributes: string[];
populateCreatorFields: boolean;
draftAndPublish: boolean;
};
attributes: { [attr: string]: IStrapi4ModelAttribute };
} | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
InterfaceDeclaration |
export interface IStrapi4ModelExtended extends IStrapi4Model {
// use to output filename
ouputFile: string;
// interface name
interfaceName: string;
// model name extract from *.(settings|schema).json filename. Use to link model.
modelName: string;
} | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
TypeAliasDeclaration |
export type StrapiType = 'string' | 'number' | 'boolean' | 'text' | 'date' | 'email' | 'component' | 'enumeration' | 'dynamiczone'; | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
TypeAliasDeclaration |
export type Strapi4AttributeType = 'string' | 'text' | 'richtext' | 'enumeration' | 'email' | 'password' | 'uid' | 'date' | 'time' | 'datetime' | 'timestamp' | 'integer' | 'biginteger' | 'float' | 'decimal' | 'boolean' | 'array' | 'json' | 'media' | 'relation' | 'component' | 'dynamiczone' | 'locale' | 'localizations'; | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
TypeAliasDeclaration |
type Strapi4RelationType = 'oneToOne' | 'oneToMany' | 'manyToOne' | 'manyToMany' | JeremiFerre/strapi-to-typescript | src/models/strapi-model.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-async-observable-pipe',
template: `
<fieldset>
<h3>Async Observable :</h3>
<h5>
Count: {{counter$ | async}}
</h5>
</fieldset>
`,
styles: []
})
export class AsyncObservablePipeComponent {
counter$: Observable<number>;
constructor() {
this.counter$ = Observable
.interval(1000);
}
} | Rachoor/AngularMaterialGo | src/app/pipes/async-observable-pipe.component.ts | TypeScript |
FunctionDeclaration | /**
* Start application
*/
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const port = app.get(ConfigService).get<number>("port");
const ip = app.get(ConfigService).get<string>("ip");
app.enableShutdownHooks();
await app.listen(port, ip);
Logger.log("Listening on " + ip + ":" + port.toString(), "NestApplication");
} | united-gameserver/TO4ST-core | to4st-core/src/main.ts | TypeScript |
ArrowFunction |
(ctor: any, superCtor: any) => {
if (superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
} | mikolaj6r/stencil | src/compiler_next/sys/modules/util.ts | TypeScript |
ArrowFunction |
(...args: any[]) =>
args.forEach(arg => console.log(arg)) | mikolaj6r/stencil | src/compiler_next/sys/modules/util.ts | TypeScript |
ArrowFunction |
arg => console.log(arg) | mikolaj6r/stencil | src/compiler_next/sys/modules/util.ts | TypeScript |
ArrowFunction |
(fn: Function): () => Promise<any> => {
if (typeof (fn as any)[promisify.custom] === 'function') {
// https://nodejs.org/api/util.html#util_custom_promisified_functions
return function (...args: any[]) {
return (fn as any)[promisify.custom].apply(this, args);
}
}
return function (...args: any[]) {
return new Promise((resolve, reject) => {
args.push((err: any, result: any) => {
if (err != null) {
reject(err);
} else {
resolve(result);
}
});
fn.apply(this, args);
});
};
} | mikolaj6r/stencil | src/compiler_next/sys/modules/util.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
args.push((err: any, result: any) => {
if (err != null) {
reject(err);
} else {
resolve(result);
}
});
fn.apply(this, args);
} | mikolaj6r/stencil | src/compiler_next/sys/modules/util.ts | TypeScript |
ArrowFunction |
(err: any, result: any) => {
if (err != null) {
reject(err);
} else {
resolve(result);
}
} | mikolaj6r/stencil | src/compiler_next/sys/modules/util.ts | TypeScript |
ArrowFunction |
speed => {
this.playbackRate = speed;
} | ThomasWo/loaner | loaner/shared/components/animation_menu/animation_menu.ts | TypeScript |
ClassDeclaration | /**
* References the content to go into the animation menu.
* Also handles the dialog closing.
*/
@Component({
host: {
'class': 'mat-typography',
},
selector: 'animation-menu',
styleUrls: ['./animation_menu.scss'],
templateUrl: './animation_menu.ng.html',
})
export class AnimationMenuComponent {
playbackRate!: number;
constructor(
private animationService: AnimationMenuService,
public dialogRef: MatDialogRef<AnimationMenuComponent>) {
this.animationService.getAnimationSpeed().subscribe(speed => {
this.playbackRate = speed;
});
}
closeDialog() {
this.animationService.setAnimationSpeed(this.playbackRate);
this.dialogRef.close();
}
} | ThomasWo/loaner | loaner/shared/components/animation_menu/animation_menu.ts | TypeScript |
MethodDeclaration |
closeDialog() {
this.animationService.setAnimationSpeed(this.playbackRate);
this.dialogRef.close();
} | ThomasWo/loaner | loaner/shared/components/animation_menu/animation_menu.ts | TypeScript |
ClassDeclaration |
@Injectable({
providedIn: "root"
})
export class EventCourseTypeCommunicationService {
private viewEventCourseTypeSubject = new Subject<EventCourseType>();
private addEventCourseTypeSubject = new Subject<EventCourseType>();
constructor() {}
sendAddEventCourseTypeEvent(eventCourseType: EventCourseType) {
this.addEventCourseTypeSubject.next(eventCourseType);
}
getAddEventCourseType(): Observable<EventCourseType> {
return this.addEventCourseTypeSubject.asObservable();
}
sendViewEventCourseTypeEvent(eventCourseTypes: EventCourseType) {
this.viewEventCourseTypeSubject.next(eventCourseTypes);
}
getViewEventCourseType(): Observable<EventCourseType> {
return this.viewEventCourseTypeSubject.asObservable();
}
} | jkumwenda/AGP | frontend/src/app/shared/services/event-course-type-communication.service.ts | TypeScript |
MethodDeclaration |
sendAddEventCourseTypeEvent(eventCourseType: EventCourseType) {
this.addEventCourseTypeSubject.next(eventCourseType);
} | jkumwenda/AGP | frontend/src/app/shared/services/event-course-type-communication.service.ts | TypeScript |
MethodDeclaration |
getAddEventCourseType(): Observable<EventCourseType> {
return this.addEventCourseTypeSubject.asObservable();
} | jkumwenda/AGP | frontend/src/app/shared/services/event-course-type-communication.service.ts | TypeScript |
MethodDeclaration |
sendViewEventCourseTypeEvent(eventCourseTypes: EventCourseType) {
this.viewEventCourseTypeSubject.next(eventCourseTypes);
} | jkumwenda/AGP | frontend/src/app/shared/services/event-course-type-communication.service.ts | TypeScript |
MethodDeclaration |
getViewEventCourseType(): Observable<EventCourseType> {
return this.viewEventCourseTypeSubject.asObservable();
} | jkumwenda/AGP | frontend/src/app/shared/services/event-course-type-communication.service.ts | TypeScript |
ArrowFunction |
() => ({ contextId, iModelId, ...openParams }) | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
ArrowFunction |
() => {
timedOut = true;
} | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
ArrowFunction |
() => ({ token: requestContext.accessToken.toTokenString(), contextId, iModelId, ...openParams }) | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
ArrowFunction |
() => ({ errorStatus: error.status, errorMessage: error.Message, iModelToken: imodelDb.iModelToken }) | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
ArrowFunction |
() => ({ name: this.name, ...this.iModelToken }) | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
ArrowFunction |
() => {
if (stmt.isShared)
this._statementCache.release(stmt);
else
stmt.dispose();
} | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
ArrowFunction |
(_name: string, value: any) => {
if (typeof value === "string") {
if (value.length >= base64Header.length && value.startsWith(base64Header)) {
const out = value.substr(base64Header.length);
const buffer = Buffer.from(out, "base64");
return new Uint8Array(buffer);
}
}
return value;
} | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
ArrowFunction |
(_name: string, value: any) => {
if (value && value.constructor === Uint8Array) {
const buffer = Buffer.from(value);
return base64Header + buffer.toString("base64");
}
return value;
} | Ranjith-K-Soman/imodeljs | core/backend/src/IModelDb.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.