@tamb/utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.2 • Public • Published

@tamb./utils

Utils I use

createElement

a simple create element function

Installation

import {createElement} from "@tamb/utils";

Usage

createElement({
    type: "div",
    text: "My text",
    attributes: [["id", "yoyo"], ["classes": ["my", "many", "classes"]]],
    children: {
        ...repeat
    },
    ref: "myRefName"
})

refs

If you use .call and bind to an object you can create a ref as a field name in that object

const x = {};

createElement.call(x, {
    type: "div",
    ref: "hey"
});

x.hey// will be your div

inserting

document.body.appendElement(createElement({type: "div"}));

Readme

Keywords

none

Package Sidebar

Install

npm i @tamb/utils

Weekly Downloads

2

Version

1.0.0-alpha.2

License

ISC

Unpacked Size

13.8 kB

Total Files

13

Last publish

Collaborators

  • tamb