repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
drkstr101/wa | web/libs/next/app/src/lib/layout/layout.spec.tsx | <gh_stars>0
import { render } from '@testing-library/react';
import Layout from './layout';
import { MockContent } from '@waweb/organisms';
describe('waweb.layout', () => {
it('should render successfully', () => {
const { container } = render(
<Layout>
<MockContent />
</Layout>
... |
drkstr101/wa | web/libs/next/app/src/lib/app.tsx | import { SSRProvider } from '@react-aria/ssr';
import { Provider } from '@react-spectrum/provider';
import { theme } from '@react-spectrum/theme-default';
import { AuthProvider } from '@watheia/waweb.auth';
import { MessageProvider } from '@watheia/waweb.message';
import { AppProps } from 'next/app';
import Head from '... |
drkstr101/wa | web/libs/api/stackbit/src/lib/get-all-author-posts-sorted.ts | import { Model, PostLayoutModel } from '@watheia/model';
import { getAllPosts } from './get-all-posts';
import { sortPosts } from './sort-posts';
export function getAllAuthorPostsSorted(objects: Model[], authorId: string) {
const allPosts = getAllPosts(objects) as PostLayoutModel[];
const authorPosts = allPosts.fi... |
drkstr101/wa | web/libs/model/src/lib/PersonModel.d.ts | <reponame>drkstr101/wa
import { Maybe } from './Maybe';
import { Model } from './Model';
export interface PersonModel extends Model {
readonly firstName: string;
readonly lastName?: string;
readonly role?: string;
readonly bio?: string;
readonly avatar: Maybe<ImageModel>;
}
|
drkstr101/wa | web/apps/expo/pages/index.tsx | import {
ActionButton,
ActionGroup,
Breadcrumbs,
Button,
ButtonGroup,
Checkbox,
Content,
Dialog,
DialogTrigger,
Divider,
Flex,
Form,
Grid,
Heading,
IllustratedMessage,
Image,
Item,
Link,
ListBox,
LogicButton,
Menu,
MenuTrigger,
Meter,
Picker,
ProgressBar,
ProgressCirc... |
drkstr101/wa | web/libs/base-ui/src/lib/image/image.tsx | <reponame>drkstr101/wa
import NextImage, { ImageProps as NextImageProps } from 'next/image';
/* eslint-disable-next-line */
export interface ImageProps extends NextImageProps {}
export const Image = ({ className, ...props }: ImageProps) => (
<div className={className}>
<NextImage {...props} />
</div>
);
expo... |
drkstr101/wa | web/libs/base-ui/src/lib/container/container.tsx | <reponame>drkstr101/wa
import clsx from 'clsx';
import { HtmlHTMLAttributes } from 'react';
/* This example requires Tailwind CSS v2.0+ */
export default function Container({
children,
className,
...props
}: HtmlHTMLAttributes<HTMLDivElement>) {
return (
<div className={clsx('max-w-7xl mx-auto sm:px-6 lg:p... |
drkstr101/wa | web/libs/assets/src/styles/index.ts | import './index.css';
|
drkstr101/wa | web/libs/waweb/message/src/lib/message-list.tsx | <reponame>drkstr101/wa
import { FunctionComponent } from 'react';
import Message, { MessageProps } from './message';
export type MessageListProps = {
messages: MessageProps[];
};
export const MessageList: FunctionComponent<MessageListProps> = ({ messages }) => (
<div className="app-messages absolute top-6... |
drkstr101/wa | web/libs/waweb/message/src/lib/message.tsx | import { AlertDialog, DialogContainer } from '@react-spectrum/dialog';
import { FunctionComponent, useState } from 'react';
export type MessageType = 'confirmation' | 'information' | 'destructive' | 'error' | 'warning';
export type MessageProps = {
type: MessageType;
message: string;
title?: string;
};... |
drkstr101/wa | web/libs/model/src/lib/ImageModel.d.ts | <reponame>drkstr101/wa
import { Maybe } from './Maybe';
import { Model } from './Model';
export interface ImageModel extends Model {
readonly id: string;
readonly filename: string;
readonly blurUpThumb: string;
readonly width: number;
readonly height: number;
readonly alt: Maybe<string>;
readonly url: st... |
drkstr101/wa | web/libs/next/utils/src/lib/next.config.ts | import analyzer from '@next/bundle-analyzer';
import withNx, { WithNxOptions } from '@nrwl/next/plugins/with-nx';
import { merge } from 'lodash';
import withPreact from 'next-plugin-preact';
import withPWA from 'next-pwa';
import transpiler from 'next-transpile-modules';
export const withBundleAnalyzer = analyzer({
... |
drkstr101/wa | web/libs/base-ui/src/index.ts | export {default as Container} from './lib/container';
export * from './lib/heading/heading';
export { default as Image } from './lib/image';
export * from './lib/link/link';
export * from './lib/text/text';
|
drkstr101/wa | web/libs/next/app/src/lib/layout/navigation.ts | const navigation = [
{
name: 'Home',
route: '/home',
},
{
name: 'Blog',
route: '/blog',
},
{
name: 'Expo',
route: '/expo',
},
{
name: 'Contact',
route: '/contact',
},
];
export default navigation;
|
drkstr101/wa | web/libs/model/src/index.ts | <filename>web/libs/model/src/index.ts
export type { CategoryModel } from './lib/CategoryModel';
export type { ContentModel } from './lib/ContentModel';
export type { ImageModel } from './lib/ImageModel';
export type { InputMaybe, MakeMaybe, MakeOptional, Maybe } from './lib/Maybe';
export type { Metadata } from './lib/... |
drkstr101/wa | web/libs/next/utils/src/lib/next-plugin-preact.d.ts | declare module 'next-plugin-preact';
|
drkstr101/wa | web/apps/home/pages/api/auth.ts | import { createClient, User } from '@supabase/supabase-js';
import { NextApiRequest, NextApiResponse } from 'next';
const supabaseUrl = process.env['NEXT_PUBLIC_SUPABASE_URL'];
const supabaseKey = process.env['SUPABASE_ADMIN_KEY'];
const supabase = createClient(supabaseUrl, supabaseKey);
const message = `Ple... |
drkstr101/wa | web/libs/base-ui/src/lib/image/index.ts | <filename>web/libs/base-ui/src/lib/image/index.ts<gh_stars>0
export { default } from './image';
export type { ImageProps } from './image';
|
drkstr101/wa | web/libs/waweb/auth/src/lib/types.ts | /**
* supabase-js also provides a compatible type `UserCredentials` but we're not using it here as it
* considers `email` as an optional field, which we aren't allowing to happen in the application yet.
*/
export type SupabaseAuthPayload = {
email: string;
password?: string;
};
|
drkstr101/wa | web/libs/utils/src/lib/url-utils.ts | const homeUrl = process.env['WA_HOME_URL'] ?? 'http://localhost:4200';
const expoUrl = process.env['WA_EXPO_URL'] ?? 'http://localhost:4210';
const contactUrl = process.env['WA_CONTACT_URL'] ?? 'http://localhost:4220';
export const HOME_URL = new URL(homeUrl);
export const EXPO_URL = new URL(expoUrl);
export const CON... |
brbnDigital/storyblok | src/type-generator/index.ts | import fs from "fs"
import path from "path"
import CamelCase from "camelcase"
import { format } from "prettier"
import { compile } from "json-schema-to-typescript"
import { client } from "../client"
import { SPACE_ID } from "../variables"
type GeneratorOptions = {
outputFile?: string
namespace?: string
}
co... |
brbnDigital/storyblok | lib/variables.d.ts | import 'dotenv/config';
export declare const STORYBLOK_API: string;
export declare const ACCESS_TOKEN: string;
export declare const SPACE_ID: string;
|
brbnDigital/storyblok | src/variables.ts | <gh_stars>0
import 'dotenv/config'
export const STORYBLOK_API: string = "https://api.storyblok.com/v1"
export const ACCESS_TOKEN = process.env.VITE_STORYBLOK_ACCESS_TOKEN ?? undefined
export const SPACE_ID = process.env.VITE_STORYBLOK_SPACE_ID ?? undefined
|
brbnDigital/storyblok | lib/client.d.ts | <reponame>brbnDigital/storyblok
import StoryblokClient from "storyblok-js-client";
declare const client: StoryblokClient;
export { client };
|
brbnDigital/storyblok | src/client.ts | <reponame>brbnDigital/storyblok
import StoryblokClient from "storyblok-js-client"
import { STORYBLOK_API, ACCESS_TOKEN, SPACE_ID } from "./variables"
if(!ACCESS_TOKEN || !SPACE_ID) throw new Error("Storyblok Access Token and Space ID are required")
const client = new StoryblokClient({ oauthToken: ACCESS_TOKEN }, STOR... |
brbnDigital/storyblok | src/asset-manager/index.ts | import { client } from "../client"
import { SPACE_ID } from "../variables"
export type Asset = {
id: number
filename: string
space_id: number
created_at: string
updated_at: string
asset_folder_id: number
deleted_at?: string
content_length: number
content_type: string
alt: string... |
brbnDigital/storyblok | lib/asset-manager/index.d.ts | <reponame>brbnDigital/storyblok
export declare type Asset = {
id: number;
filename: string;
space_id: number;
created_at: string;
updated_at: string;
asset_folder_id: number;
deleted_at?: string;
content_length: number;
content_type: string;
alt: string;
copyright: string;
... |
brbnDigital/storyblok | src/index.ts | export { client } from "./client"
export { GenerateTypes } from "./type-generator"
export { GetAssets, GetAsset, UpdateAsset } from "./asset-manager"
|
brbnDigital/storyblok | lib/index.d.ts | export { GenerateTypes } from "./type-generator";
export { GetAssets, GetAsset, UpdateAsset } from "./asset-manager";
|
brbnDigital/storyblok | lib/type-generator/index.d.ts | declare type GeneratorOptions = {
outputFile?: string;
namespace?: string;
};
export declare function GenerateTypes(options?: GeneratorOptions): Promise<void>;
export {};
|
sean-perkins/nestjs-sockets | src/app/modules/drawboard/gateways/drawboard/drawboard.gateway.ts | <reponame>sean-perkins/nestjs-sockets
import { WebSocketGateway, SubscribeMessage, WsResponse, WebSocketServer, WsException } from '@nestjs/websockets';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/from';
import 'rxjs/add/operator/map';
@WebSocketGateway(81)
export class DrawboardGateway {... |
sean-perkins/nestjs-sockets | src/app/modules/drawboard/drawboard.module.ts | <reponame>sean-perkins/nestjs-sockets<filename>src/app/modules/drawboard/drawboard.module.ts
import { Module } from '@nestjs/common';
import { DrawboardGateway } from './gateways/drawboard/drawboard.gateway';
@Module({
components: [
DrawboardGateway
]
})
export class DrawboardModule { }
|
sean-perkins/nestjs-sockets | src/app/app.module.ts | import { Module } from '@nestjs/common';
import { DrawboardModule } from './modules/drawboard/drawboard.module';
@Module({
modules: [
DrawboardModule
]
})
export class ApplicationModule { }
|
leonbechhaus/coffee-grinder-settings | src/App.tsx | import React, { useState, useEffect } from "react";
import Main from "./components/Main";
import Div100vh from "react-div-100vh";
import CoffeeListProvider from "./store/CoffeeListContext";
import StyledFirebaseAuth from "react-firebaseui/StyledFirebaseAuth";
import firebase from "firebase/app";
import Sidebar from "./... |
leonbechhaus/coffee-grinder-settings | src/components/Selection.tsx | <filename>src/components/Selection.tsx
import React, { CSSProperties } from "react";
import { Coffee } from "../types";
import CreatableSelect from "react-select/creatable";
import { CoffeeListContext } from "../store/CoffeeListContext";
const groupStyles: CSSProperties = {
display: "flex",
alignItems: "center",
... |
leonbechhaus/coffee-grinder-settings | src/components/Grinder.tsx | import React, { useState, useEffect } from "react";
import { useSwipeable } from "react-swipeable";
interface IGrinder {
grindSetting: number;
onSwiping: (eventData: any) => void;
onPlusClick: () => void;
onMinusClick: () => void;
}
const Grinder: React.FC<IGrinder> = ({
grindSetting,
onSwiping,
onMinus... |
leonbechhaus/coffee-grinder-settings | src/components/ResponsiveTable.tsx | import React from "react";
import { Table, Thead, Tbody, Tr, Th, Td } from "react-super-responsive-table";
import "react-super-responsive-table/dist/SuperResponsiveTableStyle.css";
import { CoffeeListContext } from "../store/CoffeeListContext";
import { Coffee, CoffeeList } from "../types";
interface ITable {
classN... |
leonbechhaus/coffee-grinder-settings | src/components/TastingNotes.tsx | <reponame>leonbechhaus/coffee-grinder-settings
import React, { useState, useEffect } from "react";
import { CoffeeListContext } from "../store/CoffeeListContext";
interface ITastingNotes {
className: string;
onCloseClick: () => void;
}
const TastingNotes: React.FC<ITastingNotes> = ({ className, onCloseClick }) => ... |
leonbechhaus/coffee-grinder-settings | src/components/Main.tsx | import React, { useState, useEffect } from "react";
import Grinder from "./Grinder";
import Selection from "./Selection";
import throttle from "lodash.throttle";
import { CoffeeListContext } from "../store/CoffeeListContext";
const Main = () => {
const [grindSetting_V60, setGrindSetting_V60] = useState<number>(0);
... |
leonbechhaus/coffee-grinder-settings | src/components/Sidebar.tsx | <filename>src/components/Sidebar.tsx
import React from "react";
import { CoffeeListContext } from "../store/CoffeeListContext";
interface ISideBar {
className: string;
onSignOutClick: () => void;
onInfoClick: () => void;
onTableClick: () => void;
onRemoveClick: () => void;
}
const Sidebar: React.FC<ISideBar>... |
leonbechhaus/coffee-grinder-settings | src/services/firestore.ts | <gh_stars>1-10
// @ts-nocheck
import firebase from "firebase/app";
import { Coffee } from "../types";
import "firebase/firestore";
import "firebase/auth";
const firebaseConfig = {
apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
projectId: process.env.REACT_... |
leonbechhaus/coffee-grinder-settings | src/store/CoffeeListContext.tsx | import React, { useEffect, useState, useRef } from "react";
import { CoffeeList, Coffee } from "../types";
import {
getCoffeeList,
createCoffee,
updateCoffee,
updateTastingNotes,
removeCoffee,
} from "../services/firestore";
export const CoffeeListContext = React.createContext<any | null>(null);
const Coffe... |
leonbechhaus/coffee-grinder-settings | src/types.ts | <filename>src/types.ts
export type Coffee = {
id: string,
value: string,
label: string,
v60_setting: number,
aeropress_setting: number,
available_at_home: boolean,
tasting_notes: string
}
export type CoffeeList = { label: string; options: Coffee[] } |
muskanbararia/GlobalHackathon | FrontEnd/src/app/login/login.component.ts | import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
import { UserService } from '../user.service';
import { Router } from '@angular/router';
import { ViewChild, ElementRef} from '@angular/core';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styl... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/edit-profile/edit-profile.component.ts | import { Component, OnInit } from '@angular/core';
import { UserService } from '../user.service';
import { IUser } from '../Interface/User';
@Component({
selector: 'app-edit-profile',
templateUrl: './edit-profile.component.html',
styleUrls: ['./edit-profile.component.css']
})
export class EditProfileComponent im... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/user-nav/user-nav.component.ts | <gh_stars>0
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-user-nav',
templateUrl: './user-nav.component.html',
styleUrls: ['./user-nav.component.css']
})
export class UserNavComponent implements OnInit {
constructor(private router:Rout... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/app.module.ts | <filename>FrontEnd/src/app/app.module.ts<gh_stars>0
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/app.routing.ts | import { RouterModule, Routes } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import {HomeComponent } from './home/home.component';
import { DemoComponent } from './demo/demo.component';
import { RegisterComponent } from './register/register.component';
import { UserDashComponent } from '... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/Interface/User.ts | export interface IUser {
userid:string,
username: string,
useremail: string,
userpassword: string,
usermobile: string,
latitude: any,
longitude: any,
washing:boolean
} |
muskanbararia/GlobalHackathon | FrontEnd/src/app/user.service.ts | <filename>FrontEnd/src/app/user.service.ts
import { Injectable } from '@angular/core';
import { HttpClient,HttpErrorResponse } from '@angular/common/http';
import { IUser } from '../app/Interface/User';
import { catchError } from 'rxjs/operators';
import { Observable, throwError } from 'rxjs';
@Injectable({
provided... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/register/register.component.ts | <reponame>muskanbararia/GlobalHackathon<filename>FrontEnd/src/app/register/register.component.ts
import { Component, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms';
import {UserService} from '../user.service';
import { IUser } from '../Interface/User';
import { Router } from '@angular/router';
@... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/home/home.component.ts | import { Component, OnInit } from '@angular/core';
import * as $ from 'jquery';
import 'bootstrap';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
ngAfterViewI... |
muskanbararia/GlobalHackathon | FrontEnd/src/app/user-dash/user-dash.component.ts | import { Component, OnInit } from '@angular/core';
import { UserService } from '../user.service';
import { IUser } from '../Interface/User';
@Component({
selector: 'app-user-dash',
templateUrl: './user-dash.component.html',
styleUrls: ['./user-dash.component.css']
})
export class UserDashComponent implements OnI... |
corps/teach-coding | src/primsjs.d.ts | declare module "prismjs/components/prism-core" {
declare const highlight: any;
declare const languages: any;
} |
corps/teach-coding | src/websockets.tsx | <reponame>corps/teach-coding<gh_stars>0
import {useEffect, useState} from "react";
export function useSocketSync<S extends Object, T>(state: S, defaultServerState: T, concat: (a: T, b: T) => T): [T, boolean] {
const [socket, setSocket] = useState(() => new WebSocket('ws://' + location.host + '/'));
const [serv... |
corps/teach-coding | src/session.tsx | <filename>src/session.tsx
function setCookie(name: string, value: string) {
window.localStorage[name] = value;
}
function getValue(name: string) {
return window.localStorage[name]
}
interface Session {
name: string | null,
sessionId: string | null,
group: string | null,
}
export function loadSess... |
corps/teach-coding | src/game.tsx | <filename>src/game.tsx
import {Dispatch} from "react";
import React from 'react';
const defaultSprite = {
x: 0,
y: 0,
url: "",
text: "",
}
type Sprite = typeof defaultSprite;
type GameState = {[k: string]: Sprite}
export interface GameProps {
sprites: GameState,
onClickSprite: Dispatch<strin... |
corps/teach-coding | src/components.tsx | <gh_stars>0
import React, {Dispatch, useCallback, useEffect, useMemo, useState} from 'react';
import Editor from "react-simple-code-editor";
import {highlight, languages} from "prismjs/components/prism-core";
export function CoolTextInput(props: { value: string, onChange: Dispatch<string>, placeholder: string }) {
... |
corps/teach-coding | src/index.tsx | import React, {Dispatch, ReactChild, useCallback, useEffect, useMemo, useState} from 'react';
import ReactDom from 'react-dom';
import './base.css';
import 'tachyons';
import CodeEditor from "react-simple-code-editor";
import {highlight, languages} from "prismjs/components/prism-core";
import "prismjs/components/prism-... |
2minzy/Streami | app/pages/_app.tsx | import { useEffect } from 'react';
import CssBaseline from '@material-ui/core/CssBaseline';
import { ApolloProvider } from '@apollo/client';
import { ThemeProvider, createGlobalStyle } from 'styled-components';
import { useApollo } from 'lib/apollo';
import theme from '../lib/theme';
import { AuthProvider } from 'lib/u... |
2minzy/Streami | app/components/Posts.tsx | import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
import Card from '@material-ui/core/Card';
import CardActionArea from '@material-ui/core/CardActionArea';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import... |
2minzy/Streami | app/pages/streams/index.tsx | import { useEffect } from 'react';
import Box from '@material-ui/core/Box';
import Link from 'next/link';
import Posts from 'components/Posts';
import { useStreamsQuery, Stream } from 'lib/graphql/streams.graphql';
import styled from 'styled-components';
const Container = styled.div`
margin: 160px 80px;
text-align... |
2minzy/Streami | app/pages/index.tsx | import Link from 'next/link';
import { useRef, useState, useEffect } from 'react';
import styled, { keyframes } from 'styled-components';
import showcase from '../images/showcase.jpg';
import sectionA from '../images/sectionA.jpg';
import sectionB from '../images/sectionB.jpg';
import sectionC from '../images/sectionC.... |
tao-cumplido/binary-reader | packages/enum/src/index.ts | export type { EnumFields } from './enum';
export { Enum } from './enum.js';
export { Private } from './private.js';
|
tao-cumplido/binary-reader | packages/reader/src/decoders/utf-8.spec.ts | <filename>packages/reader/src/decoders/utf-8.spec.ts
import test from 'ava';
import { BinaryReader } from '../binary-reader.js';
import { DataType } from '../data/data-type.js';
import { Encoding } from '../encoding.js';
import { ReadError } from '../read-error.js';
const type = DataType.char(Encoding.UTF8);
test('v... |
tao-cumplido/binary-reader | packages/enum/src/enum.ts | /* eslint-disable @typescript-eslint/no-invalid-void-type */
import { Private } from './private.js';
export interface EnumIdentifier {
readonly index?: number;
readonly name?: string;
}
export type EnumFields<T = void> = T extends void ? EnumIdentifier : EnumIdentifier & { readonly value?: T };
// eslint-disable-... |
tao-cumplido/binary-reader | packages/async-reader/src/async-reader.ts | import type { FileHandle } from 'fs/promises';
import { fstatSync } from 'fs';
import type { DataValue, Read, Struct } from '@nishin/reader';
import { BinaryReader, ByteOrder, DataType, Encoding } from '@nishin/reader';
import { assertInt } from '@nishin/reader/assert';
import { DataArray, DataBigInt, DataBoolean, Dat... |
tao-cumplido/binary-reader | packages/reader/src/data/data-type.ts | <reponame>tao-cumplido/binary-reader
import { Private } from '@nishin/enum';
import type { ByteOrder } from '../byte-order';
import type { Encoding } from '../encoding';
import type { DataArray } from './array';
import type { DataBigInt } from './bigint';
import type { DataBoolean } from './boolean';
import type { Dat... |
tao-cumplido/binary-reader | packages/reader/src/data/string.ts | <gh_stars>0
import type { Encoding } from '../encoding';
import { ByteOrder } from '../byte-order.js';
import { DataType } from './data-type.js';
export class DataString extends DataType {
readonly encoding: Encoding;
readonly terminator: string;
readonly count: number;
readonly byteOrder?: ByteOrder;
constructo... |
tao-cumplido/binary-reader | packages/reader/src/decoders/utf-16.ts | import type { BinaryReader, DataValue } from '../binary-reader';
import type { DataChar } from '../data';
import { DataType } from '../data/data-type.js';
import { ReadError } from '../read-error.js';
export default (type: DataChar, reader: BinaryReader): DataValue<string> => {
const intType = DataType.int({ signed: ... |
tao-cumplido/binary-reader | packages/reader/src/byte-order.ts | <reponame>tao-cumplido/binary-reader<filename>packages/reader/src/byte-order.ts
import { Enum } from '@nishin/enum';
const id = Symbol('ByteOrder');
export class ByteOrder extends Enum<'ByteOrder', number>(id) {
static readonly BigEndian = new ByteOrder(id, 0xfeff);
static readonly LittleEndian = new ByteOrder(id, ... |
tao-cumplido/binary-reader | packages/reader/src/data/array.ts | <reponame>tao-cumplido/binary-reader
import { assertInt } from '../assert.js';
import { DataType } from './data-type.js';
export class DataArray<T extends DataType> extends DataType {
readonly type: T;
readonly count: number;
constructor(type: T, count: number) {
assertInt(count, { min: 0 });
super();
this.t... |
tao-cumplido/binary-reader | packages/reader/src/index.ts | export type { DataValue, Read, Struct } from './binary-reader';
export { BinaryReader } from './binary-reader.js';
export { ByteOrder } from './byte-order.js';
export { DataType } from './data/data-type.js';
export { Encoding } from './encoding.js';
export { ReadError } from './read-error.js';
export { repeat } from '.... |
tao-cumplido/binary-reader | packages/reader/src/encoding.ts | import { Enum } from '@nishin/enum';
import { assertInt } from './assert.js';
const id = Symbol('Encoding');
export class Encoding extends Enum<'Encoding'>(id) {
static readonly ASCII = new Encoding(id, 1, 1);
static readonly ISO88591 = new Encoding(id, 1, 1);
static readonly UTF8 = new Encoding(id, 1, 4);
stati... |
tao-cumplido/binary-reader | packages/async-reader/src/repeat-async.ts | export async function repeatAsync<T>(times: number, callback: () => Promise<T>): Promise<T[]> {
const array = [];
for (let i = 0; i < times; i++) {
// eslint-disable-next-line no-await-in-loop
array.push(await callback());
}
return array;
}
|
tao-cumplido/binary-reader | packages/reader/src/data/int.ts | import type { ByteOrder } from '../byte-order';
import { assertInt } from '../assert.js';
import { DataType } from './data-type.js';
export type SafeIntBytes = 1 | 2 | 3 | 4 | 5 | 6;
export class DataInt extends DataType {
readonly signed: boolean;
readonly byteLength: SafeIntBytes;
readonly byteOrder?: ByteOrder;... |
tao-cumplido/binary-reader | packages/reader/src/binary-reader.spec.ts | /* eslint-disable @typescript-eslint/naming-convention */
import test from 'ava';
import { BinaryReader } from './binary-reader.js';
import { ByteOrder } from './byte-order.js';
import { DataType } from './data/data-type.js';
import { Encoding } from './encoding.js';
import { ReadError } from './read-error.js';
func... |
tao-cumplido/binary-reader | packages/reader/src/data/float.ts | <gh_stars>0
import type { ByteOrder } from '../byte-order';
import { assertInt } from '../assert.js';
import { DataType } from './data-type.js';
export type FloatBytes = 4 | 8;
export class DataFloat extends DataType {
readonly byteLength: FloatBytes;
readonly byteOrder?: ByteOrder;
constructor(byteLength: FloatB... |
tao-cumplido/binary-reader | packages/reader/src/data/index.ts | export { DataArray } from './array.js';
export { DataBigInt } from './bigint.js';
export { DataBoolean } from './boolean.js';
export { DataChar } from './char.js';
export { DataType } from './data-type.js';
export { DataFloat } from './float.js';
export { DataInt } from './int.js';
export { DataString } from './string.... |
tao-cumplido/binary-reader | packages/reader/src/decoders/ascii.ts | import type { BinaryReader, DataValue } from '../binary-reader';
import type { DataChar } from '../data';
import { DataType } from '../data/data-type.js';
import { ReadError } from '../read-error.js';
export default (type: DataChar, reader: BinaryReader): DataValue<string> => {
const { value } = reader.next(DataType.... |
tao-cumplido/binary-reader | packages/reader/src/decoders/utf-32.ts | import type { BinaryReader, DataValue } from '../binary-reader';
import type { DataChar } from '../data';
import { DataType } from '../data/data-type.js';
import { ReadError } from '../read-error.js';
export default (type: DataChar, reader: BinaryReader): DataValue<string> => {
const codePoint = reader.next(DataType.... |
tao-cumplido/binary-reader | packages/reader/src/repeat.ts | export function repeat<T>(times: number, callback: () => T): T[] {
return Array.from({ length: times }).map(() => callback());
}
|
tao-cumplido/binary-reader | packages/reader/src/decoders/utf-32.spec.ts | <filename>packages/reader/src/decoders/utf-32.spec.ts
import test from 'ava';
import { BinaryReader } from '../binary-reader.js';
import { ByteOrder } from '../byte-order.js';
import { DataType } from '../data/data-type.js';
import { Encoding } from '../encoding.js';
import { ReadError } from '../read-error.js';
cons... |
tao-cumplido/binary-reader | packages/reader/src/assert.ts | <filename>packages/reader/src/assert.ts
export interface AssertMessage {
message?: string;
}
export interface AssertIntMinMax extends AssertMessage {
min?: number;
max?: number;
}
export interface AssertIntValues extends AssertMessage {
values: number[];
}
export function assertInt(value: number, options: Assert... |
tao-cumplido/binary-reader | packages/reader/src/decoders/index.ts | import { Encoding } from '../encoding.js';
import ascii from './ascii.js';
import iso88591 from './iso-8859-1.js';
import utf8 from './utf-8.js';
import utf16 from './utf-16.js';
import utf32 from './utf-32.js';
export const decoders = new Map([
[Encoding.ASCII, ascii],
[Encoding.ISO88591, iso88591],
[Encoding.UTF8... |
tao-cumplido/binary-reader | packages/reader/src/read-error.ts | import type { DataType } from './data';
export class ReadError extends Error {
readonly dataType: DataType;
readonly bytes: Uint8Array;
constructor(message: string, dataType: DataType, bytes = new Uint8Array()) {
super(message);
this.dataType = dataType;
this.bytes = bytes;
}
}
|
tao-cumplido/binary-reader | packages/async-reader/src/index.ts | export { ByteOrder, DataType, Encoding, ReadError } from '@nishin/reader';
export { AsyncReader } from './async-reader.js';
export { repeatAsync } from './repeat-async.js';
|
tao-cumplido/binary-reader | packages/enum/src/private.ts | <gh_stars>0
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/explicit-module-boundary-types
export const Private = <Brand extends string>(id: symbol) => {
if (typeof id !== 'symbol') {
throw new Error(`Private id must be a symbol`);
}
// eslint-disable-next-line @typescript-esl... |
tao-cumplido/binary-reader | packages/reader/src/data/boolean.ts | <filename>packages/reader/src/data/boolean.ts
import { DataType } from './data-type.js';
export class DataBoolean extends DataType {}
DataType.boolean = function boolean() {
return new DataBoolean();
};
// @ts-expect-error
DataType.Boolean = new DataBoolean();
|
tao-cumplido/binary-reader | packages/async-reader/src/async-reader.spec.ts | <reponame>tao-cumplido/binary-reader
import fs from 'fs/promises';
import test from 'ava';
import { ByteOrder, DataType, Encoding } from '@nishin/reader';
import { AsyncReader } from './async-reader.js';
test('seek', async ({ deepEqual, throwsAsync }) => {
const path = 'dist/seek';
const handle = await fs.open(pa... |
tao-cumplido/binary-reader | packages/reader/src/decoders/ascii.spec.ts | import test from 'ava';
import { BinaryReader } from '../binary-reader.js';
import { DataType } from '../data/data-type.js';
import { Encoding } from '../encoding.js';
import { ReadError } from '../read-error.js';
const type = DataType.char(Encoding.ASCII);
test('valid', ({ deepEqual }) => {
const reader = new Bina... |
tao-cumplido/binary-reader | packages/reader/src/data/bigint.ts | import type { ByteOrder } from '../byte-order';
import { assertInt } from '../assert.js';
import { DataType } from './data-type.js';
export class DataBigInt extends DataType {
readonly signed: boolean;
readonly byteLength: number;
readonly byteOrder?: ByteOrder;
constructor(signed: boolean, byteLength: number, by... |
tao-cumplido/binary-reader | packages/reader/src/decoders/utf-8.ts | import type { BinaryReader, DataValue } from '../binary-reader';
import type { DataChar } from '../data';
import { DataType } from '../data/data-type.js';
import { ReadError } from '../read-error.js';
export default (type: DataChar, reader: BinaryReader): DataValue<string> => {
const byte1 = reader.next(DataType.Uint... |
tao-cumplido/binary-reader | packages/reader/src/data/char.ts | <reponame>tao-cumplido/binary-reader
import type { ByteOrder } from '../byte-order';
import type { Encoding } from '../encoding';
import { DataType } from './data-type.js';
export class DataChar extends DataType {
readonly encoding: Encoding;
readonly byteOrder?: ByteOrder;
constructor(encoding: Encoding, byteOrde... |
tao-cumplido/binary-reader | packages/reader/src/decoders/utf-16.spec.ts | <filename>packages/reader/src/decoders/utf-16.spec.ts
import test from 'ava';
import { BinaryReader } from '../binary-reader.js';
import { ByteOrder } from '../byte-order.js';
import { DataType } from '../data/data-type.js';
import { Encoding } from '../encoding.js';
import { ReadError } from '../read-error.js';
cons... |
tao-cumplido/binary-reader | packages/reader/src/decoders/iso-8859-1.spec.ts | <filename>packages/reader/src/decoders/iso-8859-1.spec.ts
import test from 'ava';
import { BinaryReader } from '../binary-reader.js';
import { DataType } from '../data/data-type.js';
import { Encoding } from '../encoding.js';
import { ReadError } from '../read-error.js';
const type = DataType.char(Encoding.ISO88591);... |
tao-cumplido/binary-reader | packages/reader/src/binary-reader.ts | <reponame>tao-cumplido/binary-reader
import { assertInt } from './assert.js';
import { ByteOrder } from './byte-order.js';
import {
DataArray,
DataBigInt,
DataBoolean,
DataChar,
DataFloat,
DataInt,
DataString,
DataType,
} from './data/index.js';
import { decoders } from './decoders/index.js';
import { Encoding ... |
lollipopxz/bomb-contracts | types/factories/IBasisAsset__factory.ts | <filename>types/factories/IBasisAsset__factory.ts
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from "ethers";
import { Provider } from "@ethersproject/providers";
import type { IBasisAsset, IBasisAssetInterface } from "../IBasisAsset";
co... |
lollipopxz/bomb-contracts | test/index.ts | import {expect} from 'chai';
import {ethers} from 'hardhat';
|
lollipopxz/bomb-contracts | types/factories/IShare__factory.ts | /* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer, utils } from "ethers";
import { Provider } from "@ethersproject/providers";
import type { IShare, IShareInterface } from "../IShare";
const _abi = [
{
inputs: [],
name: "claimRewards",
ou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.