type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration |
componentDidUpdate(prevProps: IRoomViewProps, prevState: IRoomViewState) {
const { roomUpdate } = this.state;
const { appState, insets, route } = this.props;
if (route?.params?.jumpToMessageId && route?.params?.jumpToMessageId !== prevProps.route?.params?.jumpToMessageId) {
this.jumpToMessage(route?.params?.... | ankitsingh1492/Rocket.Chat.ReactNative | app/views/RoomView/index.tsx | TypeScript |
MethodDeclaration |
async componentWillUnmount() {
const { editing, room } = this.state;
const db = database.active;
this.mounted = false;
if (!editing && this.messagebox && this.messagebox.current) {
// @ts-ignore
const { text } = this.messagebox.current;
let obj: TSubscriptionModel | TThreadModel | null = null;
if (... | ankitsingh1492/Rocket.Chat.ReactNative | app/views/RoomView/index.tsx | TypeScript |
InterfaceDeclaration |
export interface IProcess {
on(event: 'starting' | 'running' | 'stopping' | 'stopped', listener: () => void): this;
start(): void;
run(): Promise<void>;
stop(): Promise<void>;
getProcessHandler(): IProcessHandler;
} | kostkams/workit | packages/workit-types/src/process/process.ts | TypeScript |
ClassDeclaration | /**
* Enables you to manage DNS A Records within Azure DNS.
*/
export class ARecord extends pulumi.CustomResource {
/**
* Get an existing ARecord resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resul... | Frassle/pulumi-azure | sdk/nodejs/dns/aRecord.ts | TypeScript |
InterfaceDeclaration | /**
* Input properties used for looking up and filtering ARecord resources.
*/
export interface ARecordState {
/**
* The name of the DNS A Record.
*/
readonly name?: pulumi.Input<string>;
/**
* List of IPv4 Addresses.
*/
readonly records?: pulumi.Input<pulumi.Input<string>[]>;
... | Frassle/pulumi-azure | sdk/nodejs/dns/aRecord.ts | TypeScript |
InterfaceDeclaration | /**
* The set of arguments for constructing a ARecord resource.
*/
export interface ARecordArgs {
/**
* The name of the DNS A Record.
*/
readonly name?: pulumi.Input<string>;
/**
* List of IPv4 Addresses.
*/
readonly records: pulumi.Input<pulumi.Input<string>[]>;
/**
* Spe... | Frassle/pulumi-azure | sdk/nodejs/dns/aRecord.ts | TypeScript |
MethodDeclaration | /**
* Get an existing ARecord resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra argument... | Frassle/pulumi-azure | sdk/nodejs/dns/aRecord.ts | TypeScript |
ArrowFunction |
(req: EchoRequest) => this.request<EchoRequest, EchoResponse>("demo.DemoService/Echo", req) | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
ArrowFunction |
res => res.json().then(body => ({ res, body })) | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
ArrowFunction |
body => ({ res, body }) | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
ArrowFunction |
({ res, body }) => {
if (!res.ok) {
const err = new Error(body.msg) as TwirpError;
err.status = res.status;
err.code = body.code;
err.meta = body.meta;
throw err;
}
return body as Res;
} | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
ClassDeclaration |
export class DemoService {
prefix: string;
fetcher: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
options: TwirpOptions;
constructor(prefix: string, options: TwirpOptions = {}) {
this.prefix = prefix;
this.options = options;
if (typeof options.fetcher == "function") {
... | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
InterfaceDeclaration | // generated by protoc-gen-gotemplate. DO NOT EDIT.
// source: demo/service.proto
export interface EchoRequest {
message: string;
} | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
InterfaceDeclaration |
export interface EchoResponse {
message: string;
} | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
InterfaceDeclaration | /**
* DemoService shows a very simple service with only
* an Echo method.
*/
interface TwirpOptions {
headers?: object
fetcher?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
} | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
InterfaceDeclaration |
interface TwirpError extends Error {
status: number
code: string
meta: object
} | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
MethodDeclaration |
request<Req,Res>(method: string, variables: Req, options: TwirpOptions = {}): Promise<Res> {
return this.fetcher(this.prefix + method, {
method: "POST",
headers: {
...this.options.headers,
...options.headers,
Accept: "application/json",
"Content-Type"... | slaskis/twirp-tmpl | example/cli/demo/service.proto.ts | TypeScript |
FunctionDeclaration |
function MovieCard({ movie }: Props) {
return (
<div>
<img className="dsmovie-movie-card-image" src={movie.image} alt={movie.title} />
<div className="dsmovie-card-bottom-container">
<h3>{movie.title}</h3>
<MovieScore count={movie.count} score={movie... | Geovane404/dsmovie | frontend/src/components/MovieCard/index.tsx | TypeScript |
TypeAliasDeclaration |
type Props = {
movie: Movie;
} | Geovane404/dsmovie | frontend/src/components/MovieCard/index.tsx | TypeScript |
FunctionDeclaration |
function registerPostProcessor(
name: string,
middleware: PostProcessMiddleware,
condition?: (options: postProcessOptions) => boolean
) {
middlewareRegistry.push({ name, middleware, condition: condition || null })
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
FunctionDeclaration |
async function processHTML(
html: string,
data: renderOptions,
options: postProcessOptions
): Promise<string> {
// Don't parse unless there's at least one processor middleware
if (!middlewareRegistry[0]) {
return html
}
const postProcessData: postProcessData = {
preloads: {
images: [],
... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
FunctionDeclaration | // Calls the middleware, with some instrumentation and logging
async function callMiddleWare(
middleware: PostProcessMiddleware,
name: string
) {
let timer = Date.now()
middleware.inspect(root, postProcessData, data)
const inspectTime = Date.now() - timer
document = await middleware.mutate(doc... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
FunctionDeclaration |
function isImgEligible(imgElement: HTMLElement): boolean {
return (
imgElement.hasAttribute('src') &&
imageIsNotTooSmall(imgElement) &&
imageIsNotHidden(imgElement)
)
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
FunctionDeclaration |
function preloadTagAlreadyExists(html: string, href: string) {
const regex = new RegExp(`<link[^>]*href[^>]*${href}`)
return html.match(regex)
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
FunctionDeclaration |
function imageIsNotTooSmall(imgElement: HTMLElement): boolean {
// Skip images without both height and width--we don't know enough to say if
// they are too small
if (
!(imgElement.hasAttribute('height') && imgElement.hasAttribute('width'))
) {
return true
}
try {
if (
parseInt(imgElement... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
FunctionDeclaration | // Traverse up the dom from each image to see if it or any of it's
// ancestors have the hidden attribute.
function imageIsNotHidden(imgElement: HTMLElement): boolean {
let activeElement = imgElement
while (activeElement.parentNode) {
if (activeElement.hasAttribute('hidden')) {
return false
}
acti... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
(tag: HTMLElement) =>
tag.getAttribute('rel') === 'stylesheet' &&
tag.hasAttribute('data-href') &&
OPTIMIZED_FONT_PROVIDERS.some((url) =>
tag.getAttribute('data-href').startsWith(url)
) | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
(url) =>
tag.getAttribute('data-href').startsWith(url) | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
(element: HTMLElement) => {
const url = element.getAttribute('data-href')
this.fontDefinitions.push(url)
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
async (
markup: string,
_data: postProcessData,
options: renderOptions
) => {
let result = markup
if (!options.getFontDefinition) {
return markup
}
for (const key in this.fontDefinitions) {
const url = this.fontDefinitions[key]
if (result.indexOf(`<style data-href="${url... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
(el) => el.getAttribute('src') | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
async (markup: string, _data: postProcessData) => {
let result = markup
let imagePreloadTags = _data.preloads.images
.filter((imgHref) => !preloadTagAlreadyExists(markup, imgHref))
.reduce(
(acc, imgHref) => acc + `<link rel="preload" href="${imgHref}"/>`,
''
)
return resu... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
(imgHref) => !preloadTagAlreadyExists(markup, imgHref) | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
(acc, imgHref) => acc + `<link rel="preload" href="${imgHref}"/>` | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction | // Using process.env because passing Experimental flag through loader is not possible.
// @ts-ignore
(options) => options.optimizeFonts || process.env.__NEXT_OPTIMIZE_FONTS | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction | // @ts-ignore
(options) => options.optimizeImages || process.env.__NEXT_OPTIMIZE_IMAGES | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ClassDeclaration |
class FontOptimizerMiddleware implements PostProcessMiddleware {
fontDefinitions: Array<string> = []
inspect(
originalDom: HTMLElement,
_data: postProcessData,
options: renderOptions
) {
if (!options.getFontDefinition) {
return
}
// collecting all the requested font definitions
... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ClassDeclaration |
class ImageOptimizerMiddleware implements PostProcessMiddleware {
inspect(originalDom: HTMLElement, _data: postProcessData) {
const imgElements = originalDom.querySelectorAll('img')
let eligibleImages: Array<HTMLElement> = []
for (let i = 0; i < imgElements.length; i++) {
if (isImgEligible(imgEleme... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
InterfaceDeclaration |
interface PostProcessMiddleware {
inspect: (
originalDom: HTMLElement,
data: postProcessData,
options: renderOptions
) => void
mutate: (
markup: string,
data: postProcessData,
options: renderOptions
) => Promise<string>
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
TypeAliasDeclaration |
type postProcessOptions = {
optimizeFonts: boolean
optimizeImages: boolean
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
TypeAliasDeclaration |
type renderOptions = {
getFontDefinition?: (url: string) => string
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
TypeAliasDeclaration |
type postProcessData = {
preloads: {
images: Array<string>
}
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
TypeAliasDeclaration |
type middlewareSignature = {
name: string
middleware: PostProcessMiddleware
condition: ((options: postProcessOptions) => boolean) | null
} | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
MethodDeclaration |
inspect(
originalDom: HTMLElement,
_data: postProcessData,
options: renderOptions
) {
if (!options.getFontDefinition) {
return
}
// collecting all the requested font definitions
originalDom
.querySelectorAll('link')
.filter(
(tag: HTMLElement) =>
tag.ge... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
MethodDeclaration |
inspect(originalDom: HTMLElement, _data: postProcessData) {
const imgElements = originalDom.querySelectorAll('img')
let eligibleImages: Array<HTMLElement> = []
for (let i = 0; i < imgElements.length; i++) {
if (isImgEligible(imgElements[i])) {
eligibleImages.push(imgElements[i])
}
... | lqze/next.js | packages/next/next-server/lib/post-process.ts | TypeScript |
ArrowFunction |
() => {
const testString = 'ab/c-d=='
const encoded = base64.urlEncode(testString)
expect(base64.urlDecode(encoded)).toEqual(testString)
} | fubuloubu/ts-sdk | src/common/base64.test.ts | TypeScript |
ArrowFunction |
subscription => subscription as SubscriptionResponseDto | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
ArrowFunction |
obj => obj.topic | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class SubscribersService {
constructor(
@InjectRepository(Subscriber)
private subscriberRepository: Repository<Subscriber>,
) {}
async findAll(): Promise<SubscriptionResponseDto[]> {
const subscriptions = await this.subscriberRepository.find();
return subscriptions.map(
... | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
MethodDeclaration |
async findAll(): Promise<SubscriptionResponseDto[]> {
const subscriptions = await this.subscriberRepository.find();
return subscriptions.map(
subscription => subscription as SubscriptionResponseDto,
);
} | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
MethodDeclaration |
async findAllSubscribed(): Promise<SubscriptionResponseDto[]> {
const subscriptions = await this.subscriberRepository
.createQueryBuilder('subscriber')
.where('subscriber.subscribed = :subscribed', { subscribed: true })
.getMany();
return subscriptions.map(
subscription => subscription ... | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
MethodDeclaration |
async save(
username: string,
token: string,
topic: string,
subscribed: boolean,
): Promise<boolean> {
const subscriber = new Subscriber();
subscriber.username = `${topic}-${username}`;
subscriber.token = token;
subscriber.topic = topic;
subscriber.subscribed = subscribed;
try... | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
MethodDeclaration |
async findAllTopics(): Promise<TopicsResponseDto> {
try {
const topics = await this.subscriberRepository
.createQueryBuilder('subscriber')
.select('topic')
.distinct(true)
.getRawMany();
const dto = new TopicsResponseDto();
dto.topics = topics.map(obj => obj.topic)... | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
MethodDeclaration |
async update(token: string, subscribed: boolean): Promise<boolean> {
try {
const subscribers = await this.subscriberRepository
.createQueryBuilder('subscriber')
.where('subscriber.token = :token', { token })
.getMany();
for (const subscriber of subscribers) {
subscriber.subscr... | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
MethodDeclaration |
async findByUsername(
username: string,
): Promise<SubscriptionResponseDto | null> {
if (!username) {
throw new BadRequestException('Format is incorrect');
}
try {
const subscriber = await this.subscriberRepository.findOne({ username });
if (subscriber) {
return subscriber a... | techednelson/firebase-push-notifications-system | server/fcm-admin-server/services/subscribers.service.ts | TypeScript |
EnumDeclaration |
export enum TextWeight {
Light = 'light',
Medium = 'medium',
Heavy = 'heavy',
} | garredow/onyx-ui | src/lib/enums/textWeight.ts | TypeScript |
ArrowFunction |
<T>(yargObject: YargObject<T> | boolean): void => {
const index = Object.keys(yargObject);
if (index.length === 0) {
return;
}
const isIndexSequential = index
.sort((a: string, b: string) => (parseInt(a) > parseInt(b) ? 1 : -1))
.every((suppliedIndex: string, actualIndex: number) => parseInt(suppl... | MichielBijland/dc-cli | src/common/yargs/yargs-object-transformer.ts | TypeScript |
ArrowFunction |
(a: string, b: string) => (parseInt(a) > parseInt(b) ? 1 : -1) | MichielBijland/dc-cli | src/common/yargs/yargs-object-transformer.ts | TypeScript |
ArrowFunction |
(suppliedIndex: string, actualIndex: number) => parseInt(suppliedIndex) == actualIndex | MichielBijland/dc-cli | src/common/yargs/yargs-object-transformer.ts | TypeScript |
ArrowFunction |
<T>(yargObject: YargObject<T> | boolean): T[] => {
validateArrayIndex(yargObject);
return Object.entries(yargObject).map(entry => entry[1]);
} | MichielBijland/dc-cli | src/common/yargs/yargs-object-transformer.ts | TypeScript |
ArrowFunction |
entry => entry[1] | MichielBijland/dc-cli | src/common/yargs/yargs-object-transformer.ts | TypeScript |
InterfaceDeclaration |
export interface YargObject<T> {
[key: string]: T;
} | MichielBijland/dc-cli | src/common/yargs/yargs-object-transformer.ts | TypeScript |
ClassDeclaration |
export class DistributionList {
id: number;
createdDate: Date;
distributionList: string;
senderId: number;
userSize: number;
distributionListUsers: DistributionListUser[];
} | mondotec2010/test-push | src/app/model/distributionList.ts | TypeScript |
ClassDeclaration |
export class DistributionListUser {
id: number;
createdDate: Date;
lastModifiedDate: Date;
listId: number;
userId: number;
} | mondotec2010/test-push | src/app/model/distributionList.ts | TypeScript |
ArrowFunction |
() => {
// Automatically delete memory of missing creeps
if(Game.time%1500 === 0) {
for (const name in Memory.creeps) {
if (!(name in Game.creeps)) {
delete Memory.creeps[name];
}
}
}
} | glitchassassin/screeps | src/utils/purgeDeadCreeps.ts | TypeScript |
TypeAliasDeclaration | /**
* The possible databases to test against.
*/
export type TestDatabaseId =
| 'POSTGRES_13'
| 'POSTGRES_9'
| 'MYSQL_8'
| 'SQLITE_3'; | Ala0005/backstage | packages/backend-test-utils/src/database/types.ts | TypeScript |
TypeAliasDeclaration |
export type TestDatabaseProperties = {
name: string;
driver: string;
dockerImageName?: string;
connectionStringEnvironmentVariableName?: string;
}; | Ala0005/backstage | packages/backend-test-utils/src/database/types.ts | TypeScript |
TypeAliasDeclaration |
export type Instance = {
stopContainer?: () => Promise<void>;
databaseManager: SingleConnectionDatabaseManager;
connections: Array<Knex>;
}; | Ala0005/backstage | packages/backend-test-utils/src/database/types.ts | TypeScript |
ClassDeclaration |
export class WufWebMessagesComponentView {
util = new UtilsComponentView();
get_viewTitle() {
return element(by.css('app-root h1')).getText();
}
get_viewWufWebMessageElement() {
return element(by.css('wuf-web-message'));
}
get_errorMessageLink() {
return element(by.i... | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration |
get_viewTitle() {
return element(by.css('app-root h1')).getText();
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration |
get_viewWufWebMessageElement() {
return element(by.css('wuf-web-message'));
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration |
get_errorMessageLink() {
return element(by.id('errorMessageLink'));
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration |
get_infoMessageLink() {
return element(by.id('infoMessageLink'));
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration |
get_successMessageLink() {
return element(by.id('successMessageLink'));
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration |
get_warningMessageLink() {
return element(by.id('warningMessageLink'));
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration | /**
* Return the children
* @returns {WebElement[]}
*/
get_kgWebMessageShadowChildren() {
// browser.pause();
const deferred = protractor.promise.defer();
this.util.get_Element_ShadowRoot(this.get_viewWufWebMessageElement()).then(
function (kgWebMessageElementShadowRoo... | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration | /**
* Return the style element
* @returns {WebElement[]}
*/
get_kgWebMessageShadowStyles() {
// browser.pause();
const deferred = protractor.promise.defer();
this.util.get_Element_ShadowRoot(this.get_viewWufWebMessageElement()).then(
function (kgWebMessageElements_shad... | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration | /**
* Return all div elements
* @returns {WebElement[]}
*/
get_kgWebMessageShadowDivs() {
// browser.pause();
const deferred = protractor.promise.defer();
this.util.get_Element_ShadowRoot(this.get_viewWufWebMessageElement()).then(
function (kgWebMessageElements_shadowR... | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration | /**
* Poke into a message to extract its color
* @param {WebElement} kbWebMessageElement
* @returns {promise.Promise<string>}}
*/
get_kgWebMessageColor(kbWebMessageElement: WebElement, messageType: string) {
return kbWebMessageElement.getCssValue('color');
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration | /**
* Poke into a message to to extract its background color
* @param {WebElement} kbWebMessageElement
* @returns {promise.Promise<string>}
*/
get_kgWebMessageBackgroundColor(kbWebMessageElement: WebElement) {
return kbWebMessageElement.getCssValue('background-color');
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration | /**
* Poke into a message to to extract its text
* @param {WebElement} kbWebMessageElement
* @returns {promise.Promise<string>}
*/
get_kgWebMessageText(kbWebMessageElement: WebElement) {
const divEl = kbWebMessageElement.findElement(by.css('div'));
return divEl.getText();
} | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
MethodDeclaration | /**
* Poke into a message and click its dismissal button
* @param {WebElement} kbWebMessageElement
*/
click_kgWebMessageElement_dismissButton(kbWebMessageElement: WebElement) {
const deferred = protractor.promise.defer();
kbWebMessageElement.findElement(by.css('button')).click().then(func... | anvil-open-software/wuf | e2e/src/pages/web-messages.component.view.po.ts | TypeScript |
ClassDeclaration | /**
* The FAST Text Area Custom Element. Implements {@link @microsoft/fast-foundation#TextArea},
* {@link @microsoft/fast-foundation#TextAreaTemplate}
*
*
* @public
* @remarks
* HTML Element: \<fast-text-area\>
*
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus | delegatesFoc... | JamesBurnside/fast-dna | packages/web-components/fast-components-msft/src/text-area/index.ts | TypeScript |
ArrowFunction |
elem => this.visualize(elem, depth + 1) | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
ArrowFunction |
(a, b) => this.compare(callback(a), callback(b)) | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
TypeAliasDeclaration | /**
* Utils library
*
* Miscellaneous utility functions that don't really have a better place.
*
* It'll always be a judgment call whether or not a function goes into a
* "catch-all" library like this, so here are some guidelines:
*
* - It must not have any dependencies
*
* - It must conceivably have a use in... | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration |
escapeRegex(str: string) {
return str.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
} | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Escapes HTML in a string.
*/
escapeHTML(str: string) {
if (!str) return '';
return ('' + str)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/\//g, '/');
} | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Strips HTML from a string.
*/
stripHTML(htmlContent: string) {
if (!htmlContent) return '';
return htmlContent.replace(/<[^>]*>/g, '');
} | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Visualizes eval output in a slightly more readable form
*/
visualize(value: any, depth = 0): string {
if (value === undefined) return `undefined`;
if (value === null) return `null`;
if (typeof value === 'number' || typeof value === 'boolean') {
return `${value}`;
}
if (typeof value === 'string') ... | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Compares two variables; intended to be used as a smarter comparator.
* The two variables must be the same type (TypeScript will not check this).
*
* - Numbers are sorted low-to-high, use `-val` to reverse
* - Strings are sorted A to Z case-semi-insensitively, use `{reverse: val}` to reverse
* - Boolea... | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Sorts an array according to the callback's output on its elements.
*
* The callback's output is compared according to `PSUtils.compare` (in
* particular, it supports arrays so you can sort by multiple things).
*/
sortBy<T>(array: T[], callback: (a: T) => Comparable): T[]; | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Sorts an array according to `PSUtils.compare`. (Correctly sorts numbers,
* unlike `array.sort`)
*/
sortBy<T extends Comparable>(array: T[]): T[]; | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration |
sortBy<T>(array: T[], callback?: (a: T) => Comparable) {
if (!callback) return (array as any[]).sort(this.compare);
return array.sort((a, b) => this.compare(callback(a), callback(b)));
} | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Like string.split(delimiter), but only recognizes the first `limit`
* delimiters (default 1).
*
* `"1 2 3 4".split(" ", 2) => ["1", "2"]`
*
* `Utils.splitFirst("1 2 3 4", " ", 1) => ["1", "2 3 4"]`
*
* Returns an array of length exactly limit + 1.
*
*/
splitFirst(str: string, delimiter: string... | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /**
* Template string tag function for escaping HTML
*/
html(strings: TemplateStringsArray, ...args: any) {
let buf = strings[0];
let i = 0;
while (i < args.length) {
buf += this.escapeHTML(args[i]);
buf += strings[++i];
}
return buf;
} | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration |
shuffle<T>(arr: T[]): T[] {
// In-place shuffle by Fisher-Yates algorithm
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[arr[i], arr[j]] = [arr[j], arr[i]];
}
return arr;
} | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration | /** Forces num to be an integer (between min and max). */
clampIntRange(num: any, min?: number, max?: number): number {
if (typeof num !== 'number') num = 0;
num = Math.floor(num);
if (min !== undefined && num < min) num = min;
if (max !== undefined && num > max) num = max;
return num;
} | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
MethodDeclaration |
levenshtein(s: string, t: string, l: number): number {
// Original levenshtein distance function by James Westgate, turned out to be the fastest
const d: number[][] = [];
// Step 1
const n = s.length;
const m = t.length;
if (n === 0) return m;
if (m === 0) return n;
if (l && Math.abs(m - n) > l) retu... | AustinXII/pokemon-showdown | lib/utils.ts | TypeScript |
FunctionDeclaration | // apis
function getCompletionsAtPosition(fileName: string, position: number, options: ts.GetCompletionsAtPositionOptions | undefined): ReturnType<ts.LanguageService['getCompletionsAtPosition']> {
const finalResult = context.getTsLs().getCompletionsAtPosition(fileName, position, options);
if (finalResult) {
fina... | 10088/volar | packages/typescript-vue-plugin/src/apis.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.