How to use the compose-function function in compose-function

To help you get started, we’ve selected a few compose-function 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 vorpaljs / bash-parser / packages / bash-parser / src / modes / posix / rules / function-name.js View on Github external
export default function functionName() {
	return compose(map((tk, idx, iterable) => {
		// apply only on valid positions
		// (start of simple commands)
		// if token can form the name of a function,
		// type of token is changed from WORD to NAME

		/* console.log(
			tk._.maybeStartOfSimpleCommand,
			tk.is('WORD'),
			iterable.ahead(1) &&
				iterable.ahead(1).is('OPEN_PAREN'),
			iterable.ahead(2) &&
				iterable.ahead(2).is('CLOSE_PAREN')
		);*/

		if (
			tk._.maybeStartOfSimpleCommand &&
github tinajs / mina-webpack / packages / mina-entry-webpack-plugin / src / index.ts View on Github external
// generte request
    let request: string
    if (isClassical) {
      request = `!${minaLoader}?${JSON.stringify(
        minaLoaderOptions
      )}!${virtualMinaLoader}?${JSON.stringify({
        extensions,
      })}!${relativeRealRequest}`
    } else {
      request = relativeRealRequest
    }

    // entry name for SingleEntryPlugin
    // `../../path/to/comp` => `_/_/path/to/comp`
    const name = compose(
      ensurePosix,
      // FIXME: replace-ext will remove the leading `./` in path
      // see https://github.com/gulpjs/replace-ext/issues/5
      path => replaceExt(path, '.js'),
      urlToRequest,
      toSafeOutputPath
    )(relativeRealPath)

    // skip existing entries
    const existingEntry = entries.find(item => item.request === request)
    if (existingEntry) {
      if (parentEntry) {
        existingEntry.parents.push(parentEntry)
      }
      return
    }
github tinajs / mina-webpack / packages / mina-loader / src / loaders / mina.ts View on Github external
const originalRequest = loaderUtils.getRemainingRequest(this)
  const filePath = this.resourcePath

  let relativePath = path.relative(this.rootContext, filePath)

  // move some files into subpackages
  // .js files are moved in entry plugin but .json/.wxss/.wxml should be handled here
  // @ts-ignore
  const subpackageMapping: Record = this.subpackageMapping || {}
  const entryName = replaceExt(helpers.toSafeOutputPath(relativePath), '')
  if (subpackageMapping[entryName]) {
    relativePath = subpackageMapping[entryName] + '.mina'
  }

  const dirname = compose(
    ensurePosix,
    helpers.toSafeOutputPath,
    path.dirname
  )(relativePath)

  getBlocks(this, originalRequest)
    .then(blocks =>
      Promise.all(
        [...TAGS_FOR_FILE_LOADER, ...TAGS_FOR_OUTPUT].map(async (tag: Tag) => {
          let result: BlockResult = {
            tag,
            content: DEFAULT_CONTENT_OF_TAG[tag],
          }

          if (
            !blocks[tag] ||
github tinajs / mina-webpack / packages / mina-loader / src / loaders / mina-json.ts View on Github external
let resolve = (target: string) =>
    compose(
      ensurePosix,
      helpers.toSafeOutputPath,
      stripExt
    )(resolveFromModule(context, target))