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 * as React from "react" | |
import { BehaviorSubject } from 'rxjs'; | |
const ERROR_DETAIL = Symbol("errors") | |
const HAS_ERROR = Symbol("has error") | |
const InternalSymbolKeys = [ERROR_DETAIL,HAS_ERROR] | |
enum FieldType { | |
arrayItem, |
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
/** | |
* 重置 Vue 组件的数据 | |
* @param {Vue} instance | |
*/ | |
export function resetVueData(instance: Vue): void { | |
Object.assign(instance.$data, (instance.$option.data as any).call(instance)) | |
} |
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
/** | |
* some insane hack, just want to avoid using expensive parser. | |
*/ | |
export function getFreeVariables(expr:string, knownSymbols:Record<string,unknown>){ | |
const freeVariables = new Set<string>(); | |
//eslint-disable-next-line | |
const anyThingPrimitive = ()=>{}; |
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
/** | |
* 获取 promise 的 tuple | |
* | |
* @export | |
* @template T | |
* @template R | |
* @param promise 需要获取结果的 promise 对象 | |
* @returns {(Promise<[R] | [null, T]>)} | |
*/ |
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
const HandlerID = Symbol() | |
export function defineEvent(obj, name) { | |
const handlers = new Set() | |
const fn = function () { | |
for (const handler of handlers) { | |
try { | |
handler() | |
} catch (e) { | |
Promise.reject(e) |
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
#![feature(prelude_import)] | |
#[prelude_import] | |
use std::prelude::rust_2021::*; | |
#[macro_use] | |
extern crate std; | |
#[macro_use] | |
extern crate napi_derive; | |
use napi::bindgen_prelude::*; | |
pub struct Foo {} | |
impl napi::bindgen_prelude::TypeName for Foo { |
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 licenseData from './license.json' assert { type: 'json'} | |
import fs from 'node:fs' | |
let store = new Map() | |
Object.entries(licenseData).forEach(([name, data]) => { | |
const { licenses } = data | |
if (store.has(licenses)) { | |
store.get(licenses).push(name) | |
} else { | |
store.set(licenses, [name]) |
OlderNewer