All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.es.compile.mjs Maven / Gradle / Ivy

The newest version!
import escape from "./escape.mjs";
import CompilationJsonPointerError from "./errors/CompilationJsonPointerError.mjs"; // compile :: String[] -> String
const compile = tokens => {
  try {
    if (tokens.length === 0) {
      return '';
    }
    return `/${tokens.map(escape).join('/')}`;
  } catch (error) {
    throw new CompilationJsonPointerError('JSON Pointer compilation of tokens encountered an error.', {
      tokens,
      cause: error
    });
  }
};
export default compile;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy