This file contains hidden or 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
// strnumconvert.c | |
#include <limits.h> | |
#include <ctype.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stddef.h> | |
#include "strnumconvert.h" |
This file contains hidden or 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
json () { | |
usage () { | |
echo "Usage: json [property] [file]" | |
echo " property: (optional) The property of the JSON object to retrieve." | |
echo " file: (optional) The file containing the JSON object. Defaults to 'package.json'." | |
echo "" | |
echo "Special values for property:" | |
echo " *: Retrieve the whole object." | |
echo " --help or -h: Display this help message." | |
} |
This file contains hidden or 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
globalThis.Descriptor = class Descriptor { | |
static base(enumerable = true, configurable = true) { | |
return { enumerable, configurable } | |
} | |
static data(value, writable = true, { configurable, writable } = this.base()) { | |
return { value, enumerable, configurable, writable } | |
} | |
static accessor( getter, setter, store, { configurable, writable } = this.base()) { |
This file contains hidden or 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
/** | |
* The Walker class provides a mechanism for iterating through a string and | |
* counting occurrences of specified opening and closing characters. It's designed | |
* to start counting when the first instance of the 'open' character is encountered | |
* and stops when the count drops back to zero. | |
* | |
* @example | |
* const walker = new Walker("{a{b}c}", {when: () => {}, searchFor: Walker.squigly}); | |
* walker.until(); // Process the string | |
* |
This file contains hidden or 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
/** | |
* A simple Hasher implementation in JavaScript. This mimics the behavior of Swift's | |
* Hasher to some extent. It uses the djb2 algorithm for hashing. | |
*/ | |
class Hasher { | |
/** | |
* The constructor function takes in multiple values, flattens them into a single | |
* array, and then calls the combine method on each value. | |
* | |
* @param values - The "values" parameter is a rest parameter that allows you to |
This file contains hidden or 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
Object.assign(Object, { | |
validKey(value) { | |
return (typeof value === 'string' || typeof value === 'symbol') | |
}, | |
isObject(value) { | |
return value && (value instanceof Object || typeof value === 'object') | |
}, | |
/** |
This file contains hidden or 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
/** | |
* The function `usePseudoState` is a custom hook that allows for the creation of | |
* pseudo state variables in React. When `useState` becomes available, it should be | |
* applied to this object output by calling the `init` method with the `useState` | |
* function. | |
* | |
* The object returned from this function invocation | |
* | |
* @param initialValue - The `initialValue` parameter is the initial value that | |
* will be assigned to the pseudo state. |
This file contains hidden or 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
import { useState } from "react"; | |
function usePropertyState(obj, properties) { | |
const [_, triggerUpdate] = useState({}); | |
const [__, setObject] = useState(obj); | |
const props = properties && Array.isArray(properties) ? properties : Reflect.ownKeys(properties); | |
const propertySet = new Set(properties); | |
// Creating a proxy for the object |
This file contains hidden or 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
/* eslint-disable eqeqeq */ | |
/* eslint-disable no-new-func */ | |
import { Count, Strings, Ticker } from './ticker'; | |
/** | |
* Finds the closing token for a given opening token in a string, starting from a | |
* specified index. | |
* | |
* @param {string} str - The string in which to find the closing token. | |
* @param {number} startIndex - The index in the string from which to start the search. |
This file contains hidden or 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
import { Ticker } from './ticker.js' | |
/** | |
* The `Count` class extends the `Ticker` class and provides additional methods | |
* for arithmetic operations on the count value, like adding, subtracting, | |
* multiplying, and dividing by a specified delta value. | |
*/ | |
class Count extends Ticker { | |
/** | |
* Adds a specified delta value to the current count value and returns the |