1.0.0 • Published 3 months ago

theonefunc v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

theonefunc

converts string parameter functions and literal parameter functions

const uniFunc =
createLiteralFunc(
  createStringFunc(
    createLiteralFunc(
      createStringFunc(
        createLiteralFunc(
          /* ... */
          (s:string)=> (s)
        )
      )
    )
  )
)
console.log(uniFunc`abc${1+2}`) // abc3

const litFunc = createLiteralFunc(
  (str) => {
  return str;
});
console.log(litFunc`abc${1 + 2}`); // abc3

const strFunc = createStringFunc(
  (strings: TemplateStringsArray, ...values: any[]) => {
    return strings.reduce(
      (prev, cur, index) => prev + cur + (values[index] || ""),
      ""
    );
  }
);
console.log(strFunc(`abc${1 + 2}`)); // abc3
1.0.0

3 months ago

0.0.3

4 months ago

0.0.2

7 months ago

0.0.1

7 months ago

0.0.0

7 months ago