How to use @asd14/m - 10 common examples

To help you get started, we’ve selected a few @asd14/m examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mutantlove / tape-ui / src / app / app.container.jsx View on Github external
this.setState({
          files: map(item =>
            item.path === file.path
              ? {
                  ...item,
                  ...file,
                  isLoading: false,
                }
              : item
          )(files),
        })
      })

    // default state
    this.state = {
      files: map(
        (item): TestFile => ({
          path: item,
          name: basename(item),
          stdout: "",
          stderr: "",
          code: -1,
          isLoading: false,
        })
      )(filePaths),
      fileSelectedPath: filePaths[0],
      filterQuery: "",
      runArgs: this.executorRunArgs,
      isDebugVisible: false,
      isFilterVisible: false,
    }
  }
github mutantlove / tape-ui / src / app / app.container.jsx View on Github external
constructor(props: Props) {
    super(props)

    const { requireModules, filePattern, rootPath } = props
    const filePaths = glob.sync(`**/${filePattern}`, {
      absolute: true,
      cwd: rootPath,
    })

    // Offloading all file execution to secondary process
    this.executor = fork(`${__dirname}/../lib/executor.js`)
    this.executorRunArgs = reduce(
      (acc, item): string[] => [...acc, "-r", item],
      []
    )(requireModules)

    // Update state with file data coming from secondary forked process
    this.executor &&
      this.executor.on("message", (file: TestFile) => {
        const { files } = this.state

        this.setState({
          files: map(item =>
            item.path === file.path
              ? {
                  ...item,
                  ...file,
                  isLoading: false,
github mutantlove / tape-ui / src / ui / input / input.jsx View on Github external
this.refFilterInput.on("keypress", (code, key) => {
      if (!isEmpty(code) && /[a-zA-Z0-9 \-=\.]/.test(code)) {
        this.handleInputAdd(code)
      }
      if (key.full === "backspace") {
        this.handleInputPop()
      }
    })
github mutantlove / tape-ui / src / ui / debug / debug.jsx View on Github external
render = () => {
    const { label, value, top, left, width, height } = this.props

    return (
      
              `${entryKey}: ${JSON.stringify(entryValue)}`
          ),
          join("\n")
        )(value)}
      />
    )
  }
}
github mutantlove / tape-ui / src / ui / list / list.jsx View on Github external
onSelect(map(get("id"))(items))
        break
      case "r":
        onSelect(items[position].id)
        break
      case "home":
        onChange(
          pipe(
            head,
            get("id")
          )(items)
        )
        break
      case "end":
        onChange(
          pipe(
            tail,
            get("id")
          )(items)
        )
        break
      case "k":
      case "up":
        onChange(items[max([0, position - 1])].id)
        break
      case "j":
      case "down":
        onChange(items[min([items.length - 1, position + 1])].id)
        break
      case "pageup":
        onChange(items[max([0, position - pageSize])].id)
        break
github mutantlove / tape-ui / src / app / app.view.jsx View on Github external
actions: {
        xHandleChangeSelected,
        xHandleRun,
        xHandleFilterChange,
        xHandleFilterSubmit,
        xHandleFilterClose,
      },
    } = this.props

    const filesSelected: TestFile =
      findBy({ path: fileSelectedPath })(files) ?? {}
    const filesFiltered = filter(item => contains(filterQuery)(item.path))(
      files
    )
    const listWidth =
      pipe(
        map(item => item.name.length),
        max
      )(files) + 6

    return [
      ,
github mutantlove / tape-ui / src / ui / menu / menu.jsx View on Github external
file: {
        i: isDebugVisible ? "Hide details" : "Show details",
      },
      global: {
        "C-c": "Exit",
      },
    }

    return [
       ({ ...acc, ...value })),
          Object.entries,
          reduce(
            (acc = "", [key, value]): string =>
              `${acc}{white-bg}{black-fg}${key}{/} ${value} `
          )
        )(actions)}
      />,
github mutantlove / tape-ui / src / ui / list / list.jsx View on Github external
handleMoveKeys = (code: string, key: Object) => {
    const { items, onChange, onSelect } = this.props
    const { position } = this.state

    const pageSize = this.refList.height - 2

    switch (key.full) {
      case "M-r":
        onSelect(map(get("id"))(items))
        break
      case "r":
        onSelect(items[position].id)
        break
      case "home":
        onChange(
          pipe(
            head,
            get("id")
          )(items)
        )
        break
      case "end":
        onChange(
          pipe(
            tail,
            get("id")
          )(items)
        )
        break
      case "k":
      case "up":
        onChange(items[max([0, position - 1])].id)
github mutantlove / tape-ui / src / ui / list / list.jsx View on Github external
handleMoveKeys = (code: string, key: Object) => {
    const { items, onChange, onSelect } = this.props
    const { position } = this.state

    const pageSize = this.refList.height - 2

    switch (key.full) {
      case "M-r":
        onSelect(map(get("id"))(items))
        break
      case "r":
        onSelect(items[position].id)
        break
      case "home":
        onChange(
          pipe(
            head,
            get("id")
          )(items)
        )
        break
      case "end":
        onChange(
          pipe(
            tail,
github mutantlove / tape-ui / src / app / app.view.jsx View on Github external
xHandleChangeSelected,
        xHandleRun,
        xHandleFilterChange,
        xHandleFilterSubmit,
        xHandleFilterClose,
      },
    } = this.props

    const filesSelected: TestFile =
      findBy({ path: fileSelectedPath })(files) ?? {}
    const filesFiltered = filter(item => contains(filterQuery)(item.path))(
      files
    )
    const listWidth =
      pipe(
        map(item => item.name.length),
        max
      )(files) + 6

    return [
      ,

@asd14/m

Point free style, functional Javascript library with focus on object arrays

MIT
Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis