5.2.2 • Published 5 months ago

@forastro/utilities v5.2.2

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

For Astro Utilities

This package is a set of components and functions that make things easier to accomplish with Astro. It's a library that has functions that are useful for conditional rendering and iteration. It has a link component which is useful for creating links that indicate what page you are on. A component for creating gaps between elements. It even has two components that allow you to reuse markup.

Installation

To install this package npm i @forastro/utilities

Examples

executeIf<T extends ()=> any>(condition: boolean,cb: T): ReturnType<T> | null

 const fruits = ['Apple', 'Strawberry']

 {executeIf(!fruits.includes("Apple"), ()=> 'Not a fruit'))}

iterate<T HasForEachMethod | Generator, U>(iterable:T, (value:unknown: info:IterationInfo, key:unknown)=> U):AsyncGenerator

{iterate([1, 2, 3, 4, 5, 6], (value:number, info:IterationInfo) => (
<div style={{backgroundColor: info.isOdd ? 'red': 'blue' }} >
    {value}
</div>
))}
function useTemplaterAndProjector<
  ProjectorProps extends Record<string, unknown> | null,
  TemplaterProps extends Record<string, unknown> | null = null,
>(
  debugName?: string,
): [
  Templater<ProjectorProps, TemplaterProps>,
  Projector<TemplaterProps, ProjectorProps>,
];

Creating a template

---
 const [RandomStringTemplate, RandomStringProjector] = useTemplaterAndProjector()
---

<RandomStringTemplate>
    I'm content
</RandomStringTemplate>
<RandomStringProjector/>

Docs

Please checkout the docs for For Astro Utilities

Contributions

If you want to contribute to the repo then go to this site

5.1.5

5 months ago

5.1.4

5 months ago

5.1.3

5 months ago

5.1.2

5 months ago

5.1.1

5 months ago

5.1.0

9 months ago

5.2.2

5 months ago

5.2.1

5 months ago

5.2.0

5 months ago

5.0.1

10 months ago

5.0.0

10 months ago

5.1.7

5 months ago

5.1.6

5 months ago

4.3.8

2 years ago

4.3.6

2 years ago

4.3.7

2 years ago

4.3.5

2 years ago

2.7.0

2 years ago

2.7.1

2 years ago

3.1.2

2 years ago

3.2.0

2 years ago

3.1.1

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

4.3.2

2 years ago

4.3.1

2 years ago

4.1.3

2 years ago

4.3.4

2 years ago

4.3.3

2 years ago

4.1.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.3.0

2 years ago

4.1.2

2 years ago

4.2.0

2 years ago

4.1.1

2 years ago

2.6.0

2 years ago

2.3.0

3 years ago

2.5.0

2 years ago

2.4.0

3 years ago

2.5.1

2 years ago

2.2.4

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.3

3 years ago

0.0.1

3 years ago