Skip to content

Commit

Permalink
docs: add fre as alternative library
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenybai committed Jul 6, 2021
1 parent 5f86f76 commit 0247b89
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ We expect all Million contributors to abide by the terms of our [Code of Conduct

## Acknowledgments

Million takes heavy inspiration from [React](/~https://github.com/facebook/react), and believes in the core philosophies and values behind [Lucia](/~https://github.com/aidenybai/lucia) and [Inferno](/~https://github.com/infernojs/inferno). Feel free to check them out if you interested in an alternative library to use.
Million takes heavy inspiration from [React](/~https://github.com/facebook/react), and believes in the core philosophies and values behind [Lucia](/~https://github.com/aidenybai/lucia), [Fre](/~https://github.com/yisar/fre), and [Inferno](/~https://github.com/infernojs/inferno). Feel free to check them out if you interested in an alternative library to use.

_Why is it called "Million"? The name originated with the goal of being able to handle [1M+ ops/sec for benchmarks](/~https://github.com/aidenybai/million/tree/main/benchmarks#readme)_

Expand Down
3 changes: 2 additions & 1 deletion src/createElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ export const createElement = (vnode: VNode, attachField = true): HTMLElement | T
if (typeof vnode === 'string') return document.createTextNode(vnode);
const el = Object.assign(document.createElement(vnode.tag), vnode.props);

vnode.children &&
if (vnode.children) {
vnode.children.forEach((child) => {
el.appendChild(createElement(child));
});
}

if (attachField) el[OLD_VNODE_FIELD] = vnode;

Expand Down
20 changes: 10 additions & 10 deletions src/m.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ export const ns = (tag: string, props: VProps, children?: VNode[]): void => {
}
};

/**
* Generates a style string based on a styleObject
* @param {object} styleObject - Object with styles
* @returns
*/
export const style = (styleObject: Record<string, string>): string =>
Object.entries(styleObject)
.map((style) => style.join(':'))
.join(';');

/**
* Generates a className string based on a classObject
* @param {object} classObject - Object with classes paired with boolean values to toggle
Expand All @@ -41,6 +31,16 @@ export const className = (classObject: Record<string, boolean>): string =>
.filter((className) => classObject[className])
.join(' ');

/**
* Generates a style string based on a styleObject
* @param {object} styleObject - Object with styles
* @returns
*/
export const style = (styleObject: Record<string, string>): string =>
Object.entries(styleObject)
.map((style) => style.join(':'))
.join(';');

/**
* Helper method for creating a VNode
* @param {string} tag - The tagName of an HTMLElement
Expand Down

0 comments on commit 0247b89

Please sign in to comment.