This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modify the index.js import command: | |
import {makeObject, default as obj} from './my-mod.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to the bottom of index.js | |
let robbie = makeObject(); | |
robbie.hello(); | |
let b9 = makeObject({ name: 'B9' }); | |
b9.hello(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: UsedCheckedInput.tsx | |
// Author: Mitch Allen | |
import {ChangeEventHandler, useCallback, useState} from "react"; | |
export interface CheckedInput { | |
id?: string, | |
name?: string, | |
init?: boolean, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: UseTextInput.tsx | |
// Author: Mitch Allen | |
import {ChangeEventHandler, useCallback, useState} from "react"; | |
export interface TextInput { | |
id?: string, | |
name?: string, | |
label?: string, | |
helperText?: string, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: UseLocalStorageTextInput.tsx | |
// Author: Mitch Allen | |
import {ChangeEventHandler, useCallback, useState} from "react"; | |
export interface LocalStorageTextInput { | |
storageKey?: string, | |
id?: string, | |
name?: string, | |
label?: string, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: UseDropdownInput.tsx | |
// Author: Mitch Allen | |
import {FormControl, InputLabel, Select, Input, FormHelperText, SelectChangeEvent, MenuItem} from "@mui/material"; | |
import {ReactNode, useCallback, useState} from "react"; | |
/* | |
// App() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Mitch Allen | |
// Project: js-clone | |
// File: index.js | |
// 1. Define a nicer log function | |
let stringify = (obj) => console.log(JSON.stringify(obj,null,2)); | |
// 2. Define a source object | |
let alpha = { name: "Alpha", value: 100 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factory() { | |
let value = 42; | |
return { | |
get price() { return value }, | |
set price( p ) { | |
value = p; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createZeroBasedCounter( options = {} ) { | |
// zero based | |
// increment automatically wraps | |
let { | |
cursor = 0, | |
limit = 5, // [0..(limit -1)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Mitch Allen | |
// File: parser.js | |
import { readFileSync } from 'fs'; | |
import Ajv from 'ajv'; | |
const ajv = new Ajv(); | |
export function parser( inputFile, schemaFile ) { |