How to install tikz-uml package on Mac
#!/bin/sh
mkdir -p ~/Library/texmf/tex/latex/tikz-uml/ # It doesn't really matter where to save this file
cp ~/Downloads/tikzuml-v1.0b/tikz-uml.sty ~/Library/texmf/tex/latex/tikz-uml/
/** | |
* | |
* @param {Object} obj source object to be traversed | |
* @param {RegExp} fieldName regular expression that represents a required property | |
*/ | |
export const getFieldValues = (obj, fieldName) => { | |
if (Object.keys(obj).length === 0) { | |
return | |
} |
/** | |
* MyNewType definition | |
* @typedef {MyNewType} MyNewType | |
* @param {number} first | |
* @param {number} second | |
* @property {function} logFirst | |
* @property {function} logSecond | |
* @returns MyNewType | |
*/ |
detectBrowserlanguage(defaultLang) { | |
const navLang = navigator.language || navigator.userLanguage || defaultLang; | |
return navLang.substring(0, 2); | |
} | |
componentDidMount() { | |
const defaultLang = this.detectBrowserlanguage("en"); | |
const lang = localStorage.getItem("user-lang"); | |
const usedLang = lang ? lang : defaultLang; |
/** | |
* This function accepts array of strings or strings or both | |
* all empty or falsy values are omitted | |
* returns a string of classes | |
*@example | |
// 1) simple use case: single argument - array of strings | |
stringifyClasses([ | |
styles.day, | |
isPassive && styles.dayPassive, | |
disabled && styles.dayDisabled, |
How to install tikz-uml package on Mac
#!/bin/sh
mkdir -p ~/Library/texmf/tex/latex/tikz-uml/ # It doesn't really matter where to save this file
cp ~/Downloads/tikzuml-v1.0b/tikz-uml.sty ~/Library/texmf/tex/latex/tikz-uml/
% Preamble | |
\usepackage{tikz-uml} | |
\usetikzlibrary{positioning} | |
% Preamble end | |
... | |
\begin{tikzpicture}[shorten >=1pt,node distance=3cm,auto]%,on grid | |
\tikzstyle{state}=[shape=circle,thick,draw,minimum size=1.5cm] | |
\node[state] (A1) {$A_1$}; | |
\node[state,above of=A1] (B1) {$B_1$}; |
// 通过 typeof 来查看每种数据类型的描述 | |
// [undefined, null, true, '', 0, Symbol(), {}].map(it => typeof it) | |
// ["undefined", "object", "boolean", "string", "number", "symbol", "object"] | |
function clone(obj) { | |
// 添加一个 WeakMap 来记录已经拷贝过的对象,如果当前对象已经被拷贝过,那么直接从 WeakMap 中取出,否则重新创建一个对象并加入 WeakMap 中 | |
// ES6 推出的 WeakMap 对象,该对象是一组键/值对的集合,其中的键是弱引用的。其键必须是对象,而值可以是任意的 | |
let map = new WeakMap(); | |
function deep(data) { |
// A state machine that works from a description including explicit transitions, | |
// and can generate a transition map and a digraph | |
const STATES = Symbol("states"); | |
const STARTING_STATE = Symbol("starting-state"); | |
const TRANSITIONS = Symbol("transitions"); | |
const RESERVED = [STARTING_STATE, TRANSITIONS]; | |
const MACHINES_TO_CURRENT_STATE_NAMES = new WeakMap(); | |
const MACHINES_TO_STARTING_STATES = new WeakMap(); |
/** | |
* Ultimate version solving circular dependency with weakMap | |
* Problems: | |
* 1. Symbols not covered | |
* | |
* @param {Object} sourceObj | |
* @param {WeakMap} [hash=new WeakMap()] | |
* @returns | |
*/ | |
var deepCloneUltimate = (sourceObj, hash = new WeakMap()) => { |