@localized/core

0.3.1-alpha • Public • Published

@localized/ core

This package is not intended for usage, instead it exposes functions common to all @localized packages.

Contributing

Adding a function

Open the necessary file and just add your function! (TypeScript)

Example:

// array.ts

export function tail() {
  return function<A>(array: A[]) {
    return array.slice(1);
  }
}

As you can see, the function should take no arguments and return another function doing the necessary operations.

Adding a file

Create the new file, add all the functions you need then go in main.ts, import it (naming it fileName or concurrentFileName or sequentialFileName based on type) and export it:

// foo.ts

export function lots() {
  return function (...f: (...args: any[]) => any) {
    for (let funct of f) {
      console.log(funct());
    }
  }
}
// sequential/foo.ts

export function lots() {
  return async function (...f: (...args: any[]) => Promise<any>) {
    for (let funct of f) {
      console.log(await funct());
    }
  }
}
// main.ts

import * as foo from './foo';
import * as sequentialFoo from './sequential/foo';

export = {
  // ...
  foo
  // ...
  sequential: {
    // ...
    foo: sequentialFoo
    // ...
  }
}

Finalizing

Run npm test and push.

License

MIT

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @localized/core

    Weekly Downloads

    0

    Version

    0.3.1-alpha

    License

    MIT

    Unpacked Size

    30.2 kB

    Total Files

    14

    Last publish

    Collaborators

    • rubenverg