1.4.5 • Published 2 years ago

googlers-tools v1.4.5

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
2 years ago

Googler's Tools

My own tools / scripts that I use.

Link/link

Tools to manage URLs

Typing

  • Link - namespace
  • link - constants
import { link, Link } from "googlers-tools";

// You want get https://example.com/data.json on http://127.0.0.1:8080/data.json?
const path = link.getSubPath("data.json");
console.log(path); // >> http://example.com/data.json or http://127.0.0.1:8080/data.json

// Experimental
link.setURL((set, currentPath) => {
  set(`view_${props.id}`, `view_${props.id}`, `${currentPath}/?module=${props.id}`);
});

Rct/rct

Tools to manage some parts of React

Typing

  • Rec - namespace
  • rct - constants
import { rct, Rct } from "googlers-tools";

type AppProps {
  isMaintainable: boolean;
}

// Renders the component completely automatically and creating the root element from the display name (Requires React 18+)
rct.renderAuto<AppProps>(App, { isMaintainable: true });
// props are optional

// Renders the component in the pre created <app></app> tag (Requires React 18+)
rct.render(<App />, "app");

// Renders the component in the pre created <app></app> tag
rct.renderLegacy(<App />, "app");

Print/print

console wrapper. This feature is experimental!

Typing

  • Print - namespace
  • print - constants
import { print, Print } from "googlers-tools";

// For colors in browsers
print.styl({
  text: "Hello, world!",
  style: {
    width: "1px",
    height: "1px",
    backgroundColor: "red",
    transform: "rotateZ(45deg)",
  },
});

// For Node.js
print.log(self => {
  return self.format("\x1b[36m{content}\x1b[0m", { content: "Hello world!" });
});

// Alternative way
print.log("\x1b[36m{content}\x1b[0m", { content: "Hello world!" });

// Stringify
const test = {
  firstName: "John",
  lastName: "Smith",
  id: 123,
  isEnabled: true,
};

print.info(self => self.stringify(test, null, 4));
1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago