{"id":12705,"library":"zeptomatch-unescape","title":"Zeptomatch Unescape","description":"zeptomatch-unescape is a small, specialized JavaScript utility designed to remove backslash escape sequences from glob patterns. It specifically targets characters commonly treated as special in glob syntax (e.g., `*`, `?`, `[`, `]`), converting `\\*` to `*`, `\\?` to `?`, and so on. This normalization is crucial when you need to interpret a glob pattern literally, especially if the pattern was generated dynamically or requires further processing without accidental escape interpretation. Currently at stable version 1.0.1, the package is maintained with a focus on reliability and correctness for its specific function, implying an infrequent release cadence. It integrates seamlessly into broader pattern matching pipelines, notably mentioned as a companion to `zeptomatch-is-static` for optimizing glob evaluation by first identifying and then handling truly static parts. This clear, single-purpose design differentiates it by offering a reliable component for complex pattern manipulation workflows.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/fabiospampinato/zeptomatch-unescape","tags":["javascript","zeptomatch","unescape","typescript"],"install":[{"cmd":"npm install zeptomatch-unescape","lang":"bash","label":"npm"},{"cmd":"yarn add zeptomatch-unescape","lang":"bash","label":"yarn"},{"cmd":"pnpm add zeptomatch-unescape","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary function is exported as the default export, hence no curly braces are needed for import.","wrong":"import { unescape } from 'zeptomatch-unescape';","symbol":"unescape","correct":"import unescape from 'zeptomatch-unescape';"},{"note":"For CommonJS environments, the default export is directly assigned when requiring the module.","wrong":"const { unescape } = require('zeptomatch-unescape');","symbol":"unescape (CJS)","correct":"const unescape = require('zeptomatch-unescape');"},{"note":"While 'unescape' is a simple function, its type can be imported for explicit type annotations if needed, though `typeof unescape` often suffices.","symbol":"Types","correct":"import type { Unescape } from 'zeptomatch-unescape';"}],"quickstart":{"code":"import unescape from 'zeptomatch-unescape';\n\n// Example 1: Basic unescaping of glob special characters\nconst glob1 = 'foo\\\\*bar\\\\?';\nconst unescapedGlob1 = unescape(glob1);\nconsole.log(`Original: \"${glob1}\" -> Unescaped: \"${unescapedGlob1}\"`);\n// Expected: Original: \"foo\\*bar\\?\" -> Unescaped: \"foo*bar?\"\n\n// Example 2: Glob with no special characters or escapes\nconst glob2 = 'path/to/file.txt';\nconst unescapedGlob2 = unescape(glob2);\nconsole.log(`Original: \"${glob2}\" -> Unescaped: \"${unescapedGlob2}\"`);\n// Expected: Original: \"path/to/file.txt\" -> Unescaped: \"path/to/file.txt\"\n\n// Example 3: Mixed escapes and non-escaped characters\nconst glob3 = 'dir/\\\\*.js';\nconst unescapedGlob3 = unescape(glob3);\nconsole.log(`Original: \"${glob3}\" -> Unescaped: \"${unescapedGlob3}\"`);\n// Expected: Original: \"dir/\\*.js\" -> Unescaped: \"dir/*.js\"\n\n// Example 4: Escapes that are not glob special characters (should remain)\nconst glob4 = 'file\\\\-name.txt';\nconst unescapedGlob4 = unescape(glob4);\nconsole.log(`Original: \"${glob4}\" -> Unescaped: \"${unescapedGlob4}\"`);\n// Expected: Original: \"file\\-name.txt\" -> Unescaped: \"file\\-name.txt\"","lang":"typescript","description":"This quickstart demonstrates how to import and use the `unescape` function to remove backslash escape sequences from various glob patterns, illustrating its specific behavior."},"warnings":[{"fix":"Understand that `zeptomatch-unescape` operates strictly on glob syntax escapes. For general string unescaping, use a different utility or standard JavaScript string methods.","message":"The utility specifically unescapes glob special characters (e.g., `*`, `?`, `[`, `]`). Other backslash escapes (e.g., `\\n`, `\\t`, or non-glob character escapes like `\\-`) are preserved, as it's not a general-purpose string unescaper.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Combine with a glob parsing or validation library if robust glob pattern validation or deeper analysis is required after unescaping.","message":"This package performs only unescaping and does not validate the glob pattern's syntax or ensure it forms a valid glob after unescaping.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':71 'accident':64 'backslash':15 'broader':96 'cadenc':91 'charact':24 'clear':124 'common':25 'companion':104 'complex':137 'compon':135 'convert':33 'correct':82 'crucial':42 'current':67 'design':12,128 'differenti':129 'dynam':58 'e.g':32 'escap':16,65 'especi':52 'evalu':113 'first':115 'focus':78 'function':86 'generat':57 'glob':19,30,49,112 'handl':119 'identifi':116 'impli':87 'infrequ':89 'integr':93 'interpret':47,66 'javascript':10,141 'liter':51 'maintain':75 'manipul':139 'match':98 'mention':101 'need':45 'normal':40 'notabl':100 'offer':132 'optim':111 'packag':73 'part':122 'pattern':20,50,55,97,138 'pipelin':99 'process':62 'purpos':127 'releas':90 'reliabl':80,134 'remov':14 'requir':60 'seamless':94 'sequenc':17 'singl':126 'single-purpos':125 'small':8 'special':9,28 'specif':22,85 'stabl':69 'static':109,121 'syntax':31 'target':23 'treat':26 'truli':120 'typescript':144 'unescap':2,5,143 'util':11 'version':70 'without':63 'workflow':140 'zeptomatch':1,4,107,142 'zeptomatch-is-stat':106 'zeptomatch-unescap':3","created_at":"2026-04-19T13:44:33.416999+00:00","updated_at":"2026-04-19T13:44:33.416999+00:00","problems":[{"fix":"Change the import statement to `const unescape = require('zeptomatch-unescape');` in CommonJS files, or ensure your build configuration correctly handles ES module interop.","cause":"Incorrect CommonJS `require` syntax when trying to import a default export from an ES module.","error":"TypeError: zeptomatch_unescape_1.default is not a function"},{"fix":"Run `npm install zeptomatch-unescape` to install the package and double-check that the import path in your code exactly matches `zeptomatch-unescape`.","cause":"The package is not installed or the import path is incorrect.","error":"Cannot find module 'zeptomatch-unescape'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/fabiospampinato/zeptomatch-unescape","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/zeptomatch-unescape","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}