type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration | /**
* Sets the default offset for the overlay's connection point on the y-axis.
* @param offset New offset in the Y axis.
*/
withDefaultOffsetY(offset: number): this {
this._offsetY = offset;
return this;
} | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Configures that the position strategy should set a `transform-origin` on some elements
* inside the overlay, depending on the current position that is being applied. This is
* useful for the cases where the origin of an animation can change depending on the
* alignment of the overlay.
* @param sele... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Gets the (x, y) coordinate of a connection point on the origin based on a relative position.
*/
private _getOriginPoint(originRect: ClientRect, pos: ConnectedPosition): Point {
let x: number;
if (pos.originX == 'center') {
// Note: when centering we should always use the `left`
// offset... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and
* origin point to which the overlay should be connected.
*/
private _getOverlayPoint(
originPoint: Point,
overlayRect: ClientRect,
pos: ConnectedPosition): Point {
// Calculate the (overlayS... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Gets how well an overlay at the given point will fit within the viewport. */
private _getOverlayFit(point: Point, overlay: ClientRect, viewport: ClientRect,
position: ConnectedPosition): OverlayFit {
let {x, y} = point;
let offsetX = this._getOffset(position, 'x');
let offsetY = this._getOffset(pos... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Whether the overlay can fit within the viewport when it may resize either its width or height.
* @param fit How well the overlay fits in the viewport at some position.
* @param point The (x, y) coordinates of the overlat at some position.
* @param viewport The geometry of the viewport.
*/
private _... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Gets the point at which the overlay can be "pushed" on-screen. If the overlay is larger than
* the viewport, the top-left corner will be pushed on-screen (with overflow occuring on the
* right and bottom).
*
* @param start Starting point from which the overlay is pushed.
* @param overlay Dimensi... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Applies a computed position to the overlay and emits a position change.
* @param position The position preference
* @param originPoint The point on the origin element where the overlay is connected.
*/
private _applyPosition(position: ConnectedPosition, originPoint: Point) {
this._setTransformOrig... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Sets the transform origin based on the configured selector and the passed-in position. */
private _setTransformOrigin(position: ConnectedPosition) {
if (!this._transformOriginSelector) {
return;
}
const elements: NodeListOf<HTMLElement> =
this._boundingBox!.querySelectorAll(this._transfo... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Gets the position and size of the overlay's sizing container.
*
* This method does no measuring and applies no styles so that we can cheaply compute the
* bounds for all positions and choose the best fit based on these results.
*/
private _calculateBoundingBoxRect(origin: Point, position: Connected... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
* origin's connection point and stetches to the bounds of the viewport.
*
* @param origin The point on the origin element where the overlay is connected.
* @param position The position preference
*/
priv... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Resets the styles for the bounding box so that a new positioning can be computed. */
private _resetBoundingBoxStyles() {
extendStyles(this._boundingBox!.style, {
top: '0',
left: '0',
right: '0',
bottom: '0',
height: '',
width: '',
alignItems: '',
justifyContent: '... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Resets the styles for the overlay pane so that a new positioning can be computed. */
private _resetOverlayElementStyles() {
extendStyles(this._pane.style, {
top: '',
left: '',
bottom: '',
right: '',
position: '',
transform: '',
} as CSSStyleDeclaration);
} | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Sets positioning styles to the overlay element. */
private _setOverlayElementStyles(originPoint: Point, position: ConnectedPosition): void {
const styles = {} as CSSStyleDeclaration;
if (this._hasExactPosition()) {
const scrollPosition = this._viewportRuler.getViewportScrollPosition();
extendSt... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing. */
private _getExactOverlayY(position: ConnectedPosition,
originPoint: Point,
scrollPosition: ViewportScrollPosition) {
// Reset any existing styles. This is necessar... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Gets the exact left/right for the overlay when not using flexible sizing or when pushing. */
private _getExactOverlayX(position: ConnectedPosition,
originPoint: Point,
scrollPosition: ViewportScrollPosition) {
// Reset any existing styles. This is necessar... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /**
* Gets the view properties of the trigger and overlay, including whether they are clipped
* or completely outside the view of any of the strategy's scrollables.
*/
private _getScrollVisibility(): ScrollingVisibility {
// Note: needs fresh rects since the position could've changed.
const originBound... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Subtracts the amount that an element is overflowing on an axis from it's length. */
private _subtractOverflows(length: number, ...overflows: number[]): number {
return overflows.reduce((currentValue: number, currentOverflow: number) => {
return currentValue - Math.max(currentOverflow, 0);
}, length);
... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Narrows the given viewport rect by the current _viewportMargin. */
private _getNarrowedViewportRect(): ClientRect {
// We recalculate the viewport rect here ourselves, rather than using the ViewportRuler,
// because we want to use the `clientWidth` and `clientHeight` as the base. The difference
// being... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Whether the we're dealing with an RTL context */
private _isRtl() {
return this._overlayRef.getDirection() === 'rtl';
} | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Determines whether the overlay uses exact or flexible positioning. */
private _hasExactPosition() {
return !this._hasFlexibleDimensions || this._isPushed;
} | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Retrieves the offset of a position along the x or y axis. */
private _getOffset(position: ConnectedPosition, axis: 'x' | 'y') {
if (axis === 'x') {
// We don't do something like `position['offset' + axis]` in
// order to avoid breking minifiers that rename properties.
return position.offsetX =... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Validates that the current position match the expected values. */
private _validatePositions(): void {
if (!this._preferredPositions.length) {
throw Error('FlexibleConnectedPositionStrategy: At least one position is required.');
}
// TODO(crisbeto): remove these once Angular's template type
/... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Adds a single CSS class or an array of classes on the overlay panel. */
private _addPanelClasses(cssClasses: string | string[]) {
if (this._pane) {
coerceArray(cssClasses).forEach(cssClass => {
if (this._appliedPanelClasses.indexOf(cssClass) === -1) {
this._appliedPanelClasses.push(cssCl... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Clears the classes that the position strategy has applied from the overlay panel. */
private _clearPanelClasses() {
if (this._pane) {
this._appliedPanelClasses.forEach(cssClass => this._pane.classList.remove(cssClass));
this._appliedPanelClasses = [];
}
} | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
MethodDeclaration | /** Returns the ClientRect of the current origin. */
private _getOriginRect(): ClientRect {
const origin = this._origin;
if (origin instanceof ElementRef) {
return origin.nativeElement.getBoundingClientRect();
}
if (origin instanceof HTMLElement) {
return origin.getBoundingClientRect();
... | CaerusKaru/components | src/cdk/overlay/position/flexible-connected-position-strategy.ts | TypeScript |
ArrowFunction |
() => {
let orderFactory: DaffOrderFactory;
let stubOrder: Order;
let stubCart: DaffCart;
beforeEach(() => {
orderFactory = new DaffOrderFactory();
stubCart = new DaffCartFactory().create();
stubOrder = orderFactory.create();
});
describe('when an unknown action is triggered', () => {
i... | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
orderFactory = new DaffOrderFactory();
stubCart = new DaffCartFactory().create();
stubOrder = orderFactory.create();
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should return the current state', () => {
const action = {} as any;
const result = daffOrderReducer(initialState, action);
expect(result).toBe(initialState);
});
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
const action = {} as any;
const result = daffOrderReducer(initialState, action);
expect(result).toBe(initialState);
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
it('sets loading state to true', () => {
const placeOrderAction: DaffPlaceOrder = new DaffPlaceOrder(stubCart);
const result = daffOrderReducer(initialState, placeOrderAction);
expect(result.loading).toEqual(true);
});
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
const placeOrderAction: DaffPlaceOrder = new DaffPlaceOrder(stubCart);
const result = daffOrderReducer(initialState, placeOrderAction);
expect(result.loading).toEqual(true);
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
let result;
let state: DaffOrderReducerState;
beforeEach(() => {
state = {
...initialState,
loading: true
}
const placeOrderSuccess = new DaffPlaceOrderSuccess(stubOrder);
result = daffOrderReducer(state, placeOrderSuccess);
});
it('sets ... | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
state = {
...initialState,
loading: true
}
const placeOrderSuccess = new DaffPlaceOrderSuccess(stubOrder);
result = daffOrderReducer(state, placeOrderSuccess);
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(result.order).toEqual(stubOrder);
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(result.loading).toEqual(false);
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
let result;
let state: DaffOrderReducerState;
let stubError: string;
beforeEach(() => {
stubError = 'error message';
state = {
...initialState,
loading: true,
errors: ['existing error']
}
const placeOrderFailureAction = new DaffPlaceOrderFail... | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
stubError = 'error message';
state = {
...initialState,
loading: true,
errors: ['existing error']
}
const placeOrderFailureAction = new DaffPlaceOrderFailure(stubError);
result = daffOrderReducer(state, placeOrderFailureAction);
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(result.errors).toEqual([stubError]);
} | goutamdh/daffodil | libs/checkout/src/order/reducers/order/order.reducer.spec.ts | TypeScript |
FunctionDeclaration |
export async function getVoteData(): Promise<VoteData> {
const [yesVotes, noVotes] = await Promise.all([
getBTCVoteTransactions(true),
getBTCVoteTransactions(false),
]);
const [yes, no] = await Promise.all([transformVotes(yesVotes), transformVotes(noVotes)]);
const totals = {
support: 0n,
rej... | fungible-systems/sip-12-js | src/get-vote-data.ts | TypeScript |
ArrowFunction |
v => {
totals.support += BigInt(v.amount);
} | fungible-systems/sip-12-js | src/get-vote-data.ts | TypeScript |
ArrowFunction |
v => {
totals.reject += BigInt(v.amount);
} | fungible-systems/sip-12-js | src/get-vote-data.ts | TypeScript |
ClassDeclaration |
@ArgsType()
export class GetSchoolsArgs {
@Field({ nullable: true })
@IsOptional()
@IsString()
search?: string;
} | aybarsakgun/student-permits-backend | src/schools/dto/get-schools.args.ts | TypeScript |
ArrowFunction |
() => {
const [, setState] = useState(0);
return useCallback(() => setState((num: number): number => num + 1), []);
} | AshoneA/hooks | packages/hooks/src/useUpdate/index.ts | TypeScript |
ArrowFunction |
() => setState((num: number): number => num + 1) | AshoneA/hooks | packages/hooks/src/useUpdate/index.ts | TypeScript |
ArrowFunction |
(num: number): number => num + 1 | AshoneA/hooks | packages/hooks/src/useUpdate/index.ts | TypeScript |
InterfaceDeclaration |
export interface CustomerLight {
id: string
name: string
address: string
} | Hiswe/a-count | acount-types/customers.d.ts | TypeScript |
InterfaceDeclaration |
export interface Customer extends CustomerLight {
quotationsCount: number
quotationsTotal: number
invoicesCount: number
invoicesTotal: number
invoicesTotalPaid: number
invoicesTotalLeft: number
} | Hiswe/a-count | acount-types/customers.d.ts | TypeScript |
InterfaceDeclaration |
export interface GetAllCustomers {
rows: Customer[]
meta: ListMeta
} | Hiswe/a-count | acount-types/customers.d.ts | TypeScript |
FunctionDeclaration |
export function addStar(): void {
if (count < 750) {
// create a new star in the middle with random velocity
// add the star to the array
unchecked((stars[count] = new Star()))
count += 1
}
} | MaxGraey/as-benchmarks | graphics/starfield/assembly/index.ts | TypeScript |
FunctionDeclaration |
export function updateStars(): void {
for (let i = 0; i < count; i++) {
const star = unchecked(stars[i])
star.x = star.x + star.vx // add the velocity to the current position
star.y = star.y + star.vy // in both axles
if (star.x > 400 || star.x < -400) {
// if the star is out of bounds put it b... | MaxGraey/as-benchmarks | graphics/starfield/assembly/index.ts | TypeScript |
FunctionDeclaration |
export function setStar(i: i32): void {
const star = unchecked(stars[i])
store<f64>(0, star.x)
store<f64>(8, star.y)
store<f64>(16, star.color)
} | MaxGraey/as-benchmarks | graphics/starfield/assembly/index.ts | TypeScript |
FunctionDeclaration |
export function clear(): void {
stars = new StaticArray<Star>(750)
count = 0
} | MaxGraey/as-benchmarks | graphics/starfield/assembly/index.ts | TypeScript |
ClassDeclaration |
class Star {
constructor(
public x: f64 = 0.0,
public y: f64 = 0.0,
public vx: f64 = -5 + NativeMath.random() * 10,
public vy: f64 = -5 + NativeMath.random() * 10,
public color: f64 = 0.0
) {}
} | MaxGraey/as-benchmarks | graphics/starfield/assembly/index.ts | TypeScript |
FunctionDeclaration |
function sleep(n: number, token: CancelToken): Promise<void> {
let timer: any;
n = n >= 0 ? n | 0 : 0;
token.register(() => clearTimeout(timer));
return new Promise<void>(resolve => {
timer = setTimeout(resolve, n);
}, token);
} | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
FunctionDeclaration |
function never(token: CancelToken): Promise<never> {
return new Promise<never>(() => { /* noop */ }, token);
} | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
() => {
function sleep(n: number, token: CancelToken): Promise<void> {
let timer: any;
n = n >= 0 ? n | 0 : 0;
token.register(() => clearTimeout(timer));
return new Promise<void>(resolve => {
timer = setTimeout(resolve, n);
}, token);
}
function never(t... | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
() => clearTimeout(timer) | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
resolve => {
timer = setTimeout(resolve, n);
} | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(CancelablePromise).toBeDefined();
const cancelable = Promise.resolve();
expect(cancelable instanceof Promise).toBeTruthy();
expect(cancelable instanceof CancelablePromise).toBeTruthy();
extendPromise(false);
const normal = Promise.resolve();
expect... | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
(done) => {
const { cancel, token } = CancelToken.source();
setTimeout(() => cancel(error), 3);
const promise = Promise.resolve()
.then(() => sleep(1, token))
.then(() => sleep(1, token))
.then(() => sleep(1, token))
.then(() => never(token))
... | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
() => cancel(error) | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
() => sleep(1, token) | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
() => never(token) | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
reason => expect(reason).toBe(error) | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
async () => {
const { cancel, token } = CancelToken.source();
setTimeout(() => cancel(error), 3);
try {
await sleep(1, token);
await sleep(1, token);
await sleep(1, token);
await never(token);
} catch (e) {
expect(e).toBe(error... | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
async () => {
{
const { cancel, token } = CancelToken.source();
cancel(error);
const cancelable = Promise.resolve(50, token);
try {
await cancelable;
} catch (e) {
expect(e).toBe(error);
}
}
... | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ArrowFunction |
() => Promise.resolve(50, invalid) | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ClassDeclaration |
class InvalidToken extends CancelToken {
constructor() {
super(noop);
}
get cancelable(): boolean {
return false;
}
get requested(): boolean {
return false;
}
... | Shin-Ogata/cdp-js | packages/lib/core/promise/tests/unit/cancelable-promise.spec.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
public menu: Array<MenuItem> = [
{
link: 'md5',
title: 'MD5',
category: 'helper'
}
];
public mobile: MediaQueryList;
constructor(media: M... | Dikman/md5 | src/app/app.component.ts | TypeScript |
InterfaceDeclaration |
interface MenuItem {
link: string;
title?: string;
category: string;
} | Dikman/md5 | src/app/app.component.ts | TypeScript |
FunctionDeclaration |
function isNonNullObject(value: any): boolean {
return !!value && typeof value === 'object';
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration |
function isSpecial(value: any): boolean {
let stringValue = Object.prototype.toString.call(value);
return stringValue === '[object RegExp]' || stringValue === '[object Date]';
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration |
function isMergeableObject(value: any): boolean {
return isNonNullObject(value) && !isSpecial(value);
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration |
function getEnumerableOwnPropertySymbols(target: any): any {
return Object.getOwnPropertySymbols
? Object.getOwnPropertySymbols(target).filter(symbol => {
return target.propertyIsEnumerable(symbol);
})
: [];
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration |
function getKeys(target: any) {
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration |
function propertyIsOnObject(object: any, property: any) {
try {
return property in object;
} catch (_) {
return false;
}
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration | // Protects from prototype poisoning and unexpected merging up the prototype chain.
function propertyIsUnsafe(target: any, key: string): boolean {
return (
propertyIsOnObject(target, key) && // Properties are safe to merge if they don't exist in the target yet,
// unsafe if they exist up the prototype chain a... | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration | /**
* DFS - traverse depth first until find object with `value`. Then go back up tree and try on next key
* Need to exhaust all possible avenues.
*
* @method buildPathToValue
*/
function buildPathToValue(
source: any,
options: Options,
kv: Record<string, any>,
possibleKeys: string[]
): Record<string, any>... | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration | /**
* `source` will always have a leaf key `value` with the property we want to set
*
* @method mergeTargetAndSource
*/
function mergeTargetAndSource(target: any, source: any, options: Options): any {
getKeys(source).forEach(key => {
// proto poisoning. So can set by nested key path 'person.name'
if (pro... | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
FunctionDeclaration | /**
* goal is to mutate target with source's properties, ensuring we dont encounter
* pitfalls of { ..., ... } spread syntax overwriting keys on objects that we merged
*
* This is also adjusted for Ember peculiarities. Specifically `options.setPath` will allows us
* to handle properties on Proxy objects (that are... | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
ArrowFunction |
symbol => {
return target.propertyIsEnumerable(symbol);
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
ArrowFunction |
(key: string): void => {
let possible = source[key];
if (possible && possible.hasOwnProperty('value')) {
kv[[...possibleKeys, key].join('.')] = possible.value;
return;
}
if (typeof possible === 'object') {
buildPathToValue(possible, options, kv, [...possibleKeys, key]);
}
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
ArrowFunction |
key => {
// proto poisoning. So can set by nested key path 'person.name'
if (propertyIsUnsafe(target, key)) {
// if safeSet, we will find keys leading up to value and set
if (options.safeSet) {
const kv: Record<string, any> = buildPathToValue(source, options, {}, []);
// each key w... | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
InterfaceDeclaration |
interface Options {
safeGet: any;
safeSet: any;
} | andreyfel/validated-changeset | src/utils/merge-deep.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class StatusAPIService {
private baseUrl = 'http://127.0.0.1:8000/api/'
constructor(private http: HttpClient){ }
createHeaders(token?:string){
let data = {
"Content-Type": 'application/json',
}
if (token){
data['Authorization'] = `JWT ${token}`
}
let ... | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
MethodDeclaration |
createHeaders(token?:string){
let data = {
"Content-Type": 'application/json',
}
if (token){
data['Authorization'] = `JWT ${token}`
}
let httpOptions = {
headers: new HttpHeaders(data)
}
return httpOptions
} | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
MethodDeclaration |
list(): Observable<any>{
let apiListEndpoint = `${this.baseUrl}status/?ordering=-timestamp` // http://127.0.0.1:8000/api/status/
return this.http.get(apiListEndpoint)
} | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
MethodDeclaration |
createOrUpdate(content?:string, image?:File, id?:number, deleteImage?:boolean){
let httpMethod = 'POST'
let apiEndpoint = `${this.baseUrl}status/`
if (id){
apiEndpoint = `${this.baseUrl}status/${id}/`
httpMethod = 'PUT'
}
// console.log(apiEndpoint, httpMethod)
... | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
MethodDeclaration |
createAndUpload(fileItem?:File, extraData?:object):any{
let apiListEndpoint = `${this.baseUrl}status/`
const formData: FormData = new FormData(); //?
let fileName;
if (extraData) {
for(let key in extraData){
// iterate and set other form data
if (key == 'fileNam... | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
MethodDeclaration |
create(content?:string, image?:any): Observable<any>{
let apiListEndpoint = `${this.baseUrl}status/` // http://127.0.0.1:8000/api/status/
let data = {
'content': content
}
return this.http.post(apiListEndpoint, data)
} | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
MethodDeclaration |
update(statusItem:Status): Observable<any>{
let apiListEndpoint = `${this.baseUrl}status/${statusItem.id}/` // http://127.0.0.1:8000/api/status/
return this.http.put(apiListEndpoint, statusItem)
} | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
MethodDeclaration |
get(id?: number): Observable<Status>{
if (!id){
id = 10
}
let apiDetailEndpoint = `${this.baseUrl}status/${id}/`
return this.http.get<Status>(apiDetailEndpoint)
} | codingforentrepreneurs/Django-Angular-Ionic | client/dj-ion/src/app/status/status.service.ts | TypeScript |
ClassDeclaration |
@Component({
selector: "example-datepicker-range-strategy",
template: `
<nt-date-range-picker placeholder="开始日期">
<nt-date-range-start [(ngModel)]="startDate"></nt-date-range-start>
<nt-date-range-end [(ngModel)]="endDate"></nt-date-range-end>
</nt-date-range-picker>
<nt-date-range-picker ... | codedance-top/ng-tangram | src/app/components/datepicker/examples/range-strategy.ts | TypeScript |
ClassDeclaration |
export declare class CoordinatorApi {
private destroyed;
callCoordinatorRecursively(apiParameters: ApiParameters, retriesLeft: number): Promise<CoordinatorResponse>;
destroy: () => void;
private getResult;
private getClientRegistryRecursively;
private hello;
private static getRandomCanister... | usergeek/usergeek-ic-js | lib/es5/CoordinatorAPI.d.ts | TypeScript |
TypeAliasDeclaration |
export declare type CoordinatorResponseClientRegistry = {
"clientRegistry": {
"canisterPrincipal": Principal;
};
}; | usergeek/usergeek-ic-js | lib/es5/CoordinatorAPI.d.ts | TypeScript |
TypeAliasDeclaration |
export declare type CoordinatorResponseAnalyticsReceiver = {
"analyticsReceiver": {
"view": AnalyticsReceiverView;
};
}; | usergeek/usergeek-ic-js | lib/es5/CoordinatorAPI.d.ts | TypeScript |
TypeAliasDeclaration |
export declare type CoordinatorResponse = UGResult<CoordinatorResponseClientRegistry | CoordinatorResponseAnalyticsReceiver, "changeTopology" | UGError>; | usergeek/usergeek-ic-js | lib/es5/CoordinatorAPI.d.ts | TypeScript |
MethodDeclaration |
callCoordinatorRecursively(apiParameters: ApiParameters, retriesLeft: number): Promise<CoordinatorResponse>; | usergeek/usergeek-ic-js | lib/es5/CoordinatorAPI.d.ts | TypeScript |
ClassDeclaration |
export class Entry {
private readonly collectionCache: CollectionCache;
readonly context: string;
constructor(collectionCache: CollectionCache, values: any) {
this.collectionCache = collectionCache;
this.context = values["context"];
}
} | IMRZ/tw-db | src/generated/threekingdoms/collections/CampaignGroupMemberCriteriaCampaignContexts.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.