{"_id":"whence","_rev":"8-5ecff7ceb7659f49c277319d4a32654d","name":"whence","dist-tags":{"latest":"2.1.0"},"versions":{"0.0.1":{"name":"whence","version":"0.0.1","keywords":["@babel","@babel/parser","6to5","abstract","analysis","ast","babel","clause","compiler","context","context awareness","ecma","ecmascript","es6","esprima","estree","eval","evaluate","expr-eval","expression","function","invoke","javascript","js","match","math","object","operator","parse","parser","parsing","run","safe","safe-eval","static","syntax","tc39","transpile","transpiler","tree","when"],"author":{"url":"https://github.com/jonschlinkert","name":"Jon Schlinkert"},"license":"MIT","_id":"whence@0.0.1","maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"homepage":"https://github.com/jonschlinkert/whence","bugs":{"url":"https://github.com/jonschlinkert/whence/issues"},"dist":{"shasum":"acab6220b23bacc6587828988a13b2dd4d1205b1","tarball":"https://registry.npmjs.org/whence/-/whence-0.0.1.tgz","fileCount":4,"integrity":"sha512-U2fGWXHu++IaD+x9k1YawvaIKGRbaeRzS6XF3Dnk/xW3nnVN2eycUPKJsj2OI1Okk5nsitSv96rbuywEcto73g==","signatures":[{"sig":"MEUCIH0JtU1vyWfEed0SYOAi84eZm1wtS8oT07IbqmES9ZXdAiEAh92Lm5t852VBY73XoJ+LCqs0WLVeyItvPbMTB4k6RWI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17877,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhN4C5CRA9TVsSAnZWagAAK8MP/0Kos+aMDoAUxzhYT+FY\n9W1xKK9w89A0E6tSh8dahtHOwTwMQKMNQOkTWs23/kFyc5tAqbsKKoar09+n\n290YPHi1g22hV/SSA28rkRzeNqElL31mdZTXFI3DzMcFZwA8JpRYIzWqb1XH\nwWgpNZKfzKMDUAVXOH6/1WZIZWtcHwu/6DRsoDRYAktfoOJ1ttuujWdCmOaw\nPatOUYB6KjSZL8brVj4DgBseKVjzHtOd8fNpEkzNfel9fg2cUdnHZtzoeruP\nsXG++xhGf492ClFhMgTTK0uKcDxa7iYHtdCj/jjvqi6OnTEHxxax4q6SA6TY\nF7nihsh+qyOM/JJt4/Itxz5ku7Exz6z8iq/wdldnuEP01aZ3MWtBs9LESIiw\nKJduQdxmHEv1wtgeiilDBBrG1SGfw+GlUk76ZLEi/HlwVwYPFVIOdkH6TCkZ\nf2DcD86Otz4fGLObO2UGZ/RoLeLJvLzUwTorxCU6A2bIBN5d2CGLVHgtFZYA\n1P/uU8wox4yi/URSRHpE2deIm8wPvXplAgt2QpdPiDHDPRnq+beDbM5aiJBg\nazfYub8OPa3kXJU6Rb/2nbbYJu9XiT/VH9H69m8x+WyC8kue5VKKqNYrLtWF\ncq+MlnJvfLdBNz0P9CVvZGecE8RUF7tn7ahSgwJdbC3fnXnF7xXveQfFI58L\ny5S8\r\n=3WyT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","verb":{"toc":false,"lint":{"reflinks":true},"tasks":["readme"],"layout":"default","plugins":["gulp-format-md"],"related":{"list":[]},"reflinks":["estree","eval-estree-expression"]},"engines":{"node":">=14"},"gitHead":"8fd1132737d2f0c8f3d62423cb2cde646e4b02c0","scripts":{"test":"mocha --recursive --ignore 'test/support/**'","cover":"nyc --reporter=text --reporter=html npm run test","test:ci":"nyc --reporter=lcov npm run test"},"_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"repository":{"url":"git+https://github.com/jonschlinkert/whence.git","type":"git"},"_npmVersion":"7.18.1","description":"Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.","directories":{},"_nodeVersion":"16.4.2","dependencies":{"@babel/parser":"^7.15.5","eval-estree-expression":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^9.1.1","esprima":"^4.0.1","gulp-format-md":"^2.0.0","@babel/eslint-parser":"^7.15.4","@babel/eslint-plugin":"^7.14.5"},"_npmOperationalInternal":{"tmp":"tmp/whence_0.0.1_1631027385764_0.44823291190933245","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"whence","version":"1.0.0","keywords":["@babel","@babel/parser","6to5","abstract","analysis","ast","babel","clause","compiler","context","context awareness","ecma","ecmascript","es6","esprima","estree","eval","evaluate","expr-eval","expression","function","invoke","javascript","js","match","math","object","operator","parse","parser","parsing","run","safe","safe-eval","static","syntax","tc39","transpile","transpiler","tree","when"],"author":{"url":"https://github.com/jonschlinkert","name":"Jon Schlinkert"},"license":"MIT","_id":"whence@1.0.0","maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"homepage":"https://github.com/jonschlinkert/whence","bugs":{"url":"https://github.com/jonschlinkert/whence/issues"},"dist":{"shasum":"51dafdee485cca3a519dc808e189b8d6e8fb3ff1","tarball":"https://registry.npmjs.org/whence/-/whence-1.0.0.tgz","fileCount":4,"integrity":"sha512-r+ujUVvVO22le/LZrPll86kBdNkTWXvmtulJSA6AF2fPuIEfHw04PtMhkN4CMR+e0NVJFJH+9EN9wPKtpoHmNg==","signatures":[{"sig":"MEUCICPaznCVZEZf/6T61Ie0wcphBRwIb4CLSXxwkNvtUxP8AiEAjF6HhP8tfBNkHwywa+55VdopbNErwVNGE13Y14efTM4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18073,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhN4KRCRA9TVsSAnZWagAAuF4P/3EDcM1Hw7u4+/gxhy3S\nQ9e117UrinBNRM+dQSoIpDkaqjbhB1iO/RUUWhvSm3pO3lTUFJlU4jPhWRJ3\nGGKzou3atP+I7twxq/lcpi3alG9GYkgZfi4JTWK1Z4hJkQ8xoSnPxnXa7bM6\n39yL82JScs+01RBnhaqpLwk1CYTY/M5hXjrgJeOm1dLWLYYQ/0hOkws4BPfd\n3Vj+0GnsnMB29FinEPSOTE5BGiglWBGvKBFIEUGLnGDhGwSvYWAk1MytQnvW\nh0aF1VcE1YFnB1m1xzVRorlFGdCKo5O1YrifeZWMMqPoEOtha973zv3bf6b/\njG8am07sXmJuJfoFL/oiR7aiICNo7YWo8I+GmLKbvhzrHyp8ILcLz/UOLjZN\nML64nGYh2wVXbuI56NR0KROpq09pwbnzpFWm8fFRD9s/lyGKhEQ5kN22MjyC\nt3WpG//EV3fKsCf5VgDv/IPbO7x+4NMRA+PethXJIelZugkDisY9idQGWizj\nyQJ2p+LqLpdQ0zz0q0bIUP82VHbuL+auLID2zpwOmB7OBX98qC86fDA2TEWy\n2JnsJOVuLDrNQC9qbNdPBoOICivz/0KQ5YM3ry0CdsDmlL7wNZrmY2zcPmXo\nQFr7sd/WkIWXFgcjnFrHQafvJgKkbDSEVbsPmv7X6Nij0vMQ6c94KpRCmIOU\nXIVB\r\n=Mse0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","verb":{"toc":false,"lint":{"reflinks":true},"tasks":["readme"],"layout":"default","plugins":["gulp-format-md"],"related":{"list":[]},"reflinks":["estree","eval-estree-expression"]},"engines":{"node":">=14"},"gitHead":"495bf410cb0d7c01d1935797e7218d34418e185e","scripts":{"test":"mocha --recursive --ignore 'test/support/**'","cover":"nyc --reporter=text --reporter=html npm run test","test:ci":"nyc --reporter=lcov npm run test"},"_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"repository":{"url":"git+https://github.com/jonschlinkert/whence.git","type":"git"},"_npmVersion":"7.18.1","description":"Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.","directories":{},"_nodeVersion":"16.4.2","dependencies":{"@babel/parser":"^7.15.5","eval-estree-expression":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^9.1.1","esprima":"^4.0.1","gulp-format-md":"^2.0.0","@babel/eslint-parser":"^7.15.4","@babel/eslint-plugin":"^7.14.5"},"_npmOperationalInternal":{"tmp":"tmp/whence_1.0.0_1631027856872_0.4358203419663087","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"whence","version":"2.0.0","keywords":["@babel","@babel/parser","6to5","abstract","analysis","ast","babel","clause","compiler","context","context awareness","ecma","ecmascript","es6","esprima","estree","eval","evaluate","expr-eval","expression","function","invoke","javascript","js","match","math","object","operator","parse","parser","parsing","run","safe","safe-eval","static","syntax","tc39","transpile","transpiler","tree","when"],"author":{"url":"https://github.com/jonschlinkert","name":"Jon Schlinkert"},"license":"MIT","_id":"whence@2.0.0","maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"homepage":"https://github.com/jonschlinkert/whence","bugs":{"url":"https://github.com/jonschlinkert/whence/issues"},"dist":{"shasum":"531508b322bc8d5102f0e2cd88b21d65b92562fd","tarball":"https://registry.npmjs.org/whence/-/whence-2.0.0.tgz","fileCount":4,"integrity":"sha512-exmM13v2lg8juBbfS2tao/alV68jyryPXS+jf29NBNGLzE2hRgmzvQFQGX5CxNfH4Ag9qRqd6gGpXTH2JxqKHg==","signatures":[{"sig":"MEUCIE9ALoN9JZu7PRJFnfSsRGxbmmRV7IEENxdf/xH4k9ZzAiEAmLwUCtfaGuKystW8vViy8h10zePLi6AcfHJbl2lzef4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22195,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3BQbCRA9TVsSAnZWagAAVDoQAJeBLyybHvR5inO6LCTE\n+tnENSZ0qTTpegIg9qpf0JT8+Pd2zRkQJScicq32drIa0Khcie5S0ix1Bd7T\nheUgw10f5F64rDzdt75aCE/q0W47Qw3eFW67PE1d4dixw8ufylZt67iNEJe8\nHqnsgmHYyb8jvjNpAy3WPtGfOgt5CjsCMqnPv9+1w6ogLfsNCnyNhQyLK3WF\n62K9n/oyRVQooIS2nUS8NgyET89KDDYZ4Gz7eQjt5cPP1WMhW1ZuZ9u7bISc\nB0oSOG2+DxD83X2bjWWfAh7ffrqjFGtOginZIAFOINoJwsUetPs+LOV+6RBE\nzYx9LEtQbCJCupMk0oCdi46lpuLERuZ4ra7/w3NuEPjf4dY7kPVytkEnqCT/\nwmlwISF9RVgAPB5/ZH6bi4GRFHHwJCo/4sMeXQcxTUNhwL10MR0i3idGBpoM\n41NeMazNJCTopDv6YKr44ueBqPOYmqZBLe0+bJKCTVKo9dJFACGSc6s3GMfE\n+wtKZERgfddRjsHaD93dZM+nmvyBn3aNTzUHdYOreFQew1Fs1XKoEA7xI3wP\nJwCh3w5Fh/BsMEvHGfXygZaakhxzbxKujQurQV/N8znlwWGd8BXRky/0SkDG\nyO+TXRsJ+uxb2jKt/yavH8ibqHrllcJPxW4+vngpKOhgNIL5EUc89pDj9GY0\n5qNB\r\n=cQAs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","verb":{"toc":false,"lint":{"reflinks":true},"tasks":["readme"],"layout":"default","plugins":["gulp-format-md"],"related":{"list":[]},"reflinks":["estree","eval-estree-expression"]},"engines":{"node":">=14"},"gitHead":"f1705a07b5f9c2e0bdad3336018a68ad98504279","scripts":{"test":"mocha --recursive --ignore 'test/support/**'","cover":"nyc --reporter=text --reporter=html npm run test","test:ci":"nyc --reporter=lcov npm run test"},"_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"repository":{"url":"git+https://github.com/jonschlinkert/whence.git","type":"git"},"_npmVersion":"7.21.1","description":"Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.","directories":{},"_nodeVersion":"16.9.1","dependencies":{"@babel/parser":"^7.15.7","eval-estree-expression":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^9.1.1","esprima":"^4.0.1","gulp-format-md":"^2.0.0","@babel/eslint-parser":"^7.15.4","@babel/eslint-plugin":"^7.14.5"},"_npmOperationalInternal":{"tmp":"tmp/whence_2.0.0_1632292849144_0.2201764380627531","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"whence","version":"2.0.1","keywords":["@babel","@babel/parser","6to5","abstract","analysis","ast","babel","clause","compiler","context","context awareness","ecma","ecmascript","es6","esprima","estree","eval","evaluate","expr-eval","expression","function","invoke","javascript","js","match","math","object","operator","parse","parser","parsing","run","safe","safe-eval","static","syntax","tc39","transpile","transpiler","tree","when"],"author":{"url":"https://github.com/jonschlinkert","name":"Jon Schlinkert"},"license":"MIT","_id":"whence@2.0.1","maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"homepage":"https://github.com/jonschlinkert/whence","bugs":{"url":"https://github.com/jonschlinkert/whence/issues"},"dist":{"shasum":"0ce867ae2da894e1e0f045b400e2a5e6aac6ad06","tarball":"https://registry.npmjs.org/whence/-/whence-2.0.1.tgz","fileCount":4,"integrity":"sha512-VtcCE1Pe3BKofF/k+P5xcpuoqQ0f1NJY6TmdUw5kInl9/pEr1ZEFD9+ZOUicf52tvpTbhMS93aWXriu2IQYTTw==","signatures":[{"sig":"MEYCIQDicKWII5J1Txz9Vgg0gOc/h9z9nuT27UmmtUBDx9DbMQIhAJYjfd9Qf3hOGit3EsMsuO3vBQSxDZTYUOeJZzQxrTv2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22195},"main":"index.js","verb":{"toc":false,"lint":{"reflinks":true},"tasks":["readme"],"layout":"default","plugins":["gulp-format-md"],"related":{"list":[]},"reflinks":["estree","eval-estree-expression"]},"engines":{"node":">=14"},"gitHead":"7077ced3395b6b2814d93c40fc1e295741603789","scripts":{"test":"mocha --recursive --ignore 'test/support/**'","cover":"nyc --reporter=text --reporter=html npm run test","test:ci":"nyc --reporter=lcov npm run test"},"_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"repository":{"url":"git+https://github.com/jonschlinkert/whence.git","type":"git"},"_npmVersion":"10.7.0","description":"Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.","directories":{},"_nodeVersion":"20.12.1","dependencies":{"@babel/parser":"^7.24.7","eval-estree-expression":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^9.1.1","esprima":"^4.0.1","gulp-format-md":"^2.0.0","@babel/eslint-parser":"^7.15.4","@babel/eslint-plugin":"^7.14.5"},"_npmOperationalInternal":{"tmp":"tmp/whence_2.0.1_1718664278369_0.8738205770665946","host":"s3://npm-registry-packages"}},"2.0.2":{"name":"whence","version":"2.0.2","keywords":["@babel","@babel/parser","6to5","abstract","analysis","ast","babel","clause","compiler","context","context awareness","ecma","ecmascript","es6","esprima","estree","eval","evaluate","expr-eval","expression","function","invoke","javascript","js","match","math","object","operator","parse","parser","parsing","run","safe","safe-eval","static","syntax","tc39","transpile","transpiler","tree","when"],"author":{"url":"https://github.com/jonschlinkert","name":"Jon Schlinkert"},"license":"MIT","_id":"whence@2.0.2","maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"homepage":"https://github.com/jonschlinkert/whence","bugs":{"url":"https://github.com/jonschlinkert/whence/issues"},"dist":{"shasum":"559a5ec53af568c8065c9c65501cd5cec06bd368","tarball":"https://registry.npmjs.org/whence/-/whence-2.0.2.tgz","fileCount":4,"integrity":"sha512-dSzQeVdKM4BJ+mVMXD/MOt4LrZxMpjuNmRi7hqkDEmFJMPnLbEc0hSWR3mN/S0xkLlWuWTPg89lrTNFX4lGpdA==","signatures":[{"sig":"MEUCIDEc/fbgwXGbibLbecSvFQUYkXgTokCllXA2C55xuplqAiEAo5XBSc02eHJvon+dbXYnbEvmUs4JVEB4aAcPFOMJ3Cw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22195},"main":"index.js","verb":{"toc":false,"lint":{"reflinks":true},"tasks":["readme"],"layout":"default","plugins":["gulp-format-md"],"related":{"list":[]},"reflinks":["estree","eval-estree-expression"]},"engines":{"node":">=14"},"gitHead":"577c60b235573542afc41952b54528c796aea8b4","scripts":{"test":"mocha --recursive --ignore 'test/support/**'","cover":"nyc --reporter=text --reporter=html npm run test","test:ci":"nyc --reporter=lcov npm run test"},"_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"repository":{"url":"git+https://github.com/jonschlinkert/whence.git","type":"git"},"_npmVersion":"10.9.2","description":"Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@babel/parser":"^7.26.7","eval-estree-expression":"^2.1.1"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^9.2.2","eslint":"8.57.0","esprima":"^4.0.1","prettier":"^3.4.2","gulp-format-md":"^2.0.0","@babel/eslint-parser":"^7.26.5","@babel/eslint-plugin":"^7.25.9"},"_npmOperationalInternal":{"tmp":"tmp/whence_2.0.2_1738904788124_0.631200410640878","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"whence","description":"Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.","version":"2.1.0","homepage":"https://github.com/jonschlinkert/whence","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/whence.git"},"bugs":{"url":"https://github.com/jonschlinkert/whence/issues"},"engines":{"node":">=14"},"main":"index.js","license":"MIT","scripts":{"test":"mocha --recursive --ignore 'test/support/**'","test:ci":"nyc --reporter=lcov npm run test","cover":"nyc --reporter=text --reporter=html npm run test"},"dependencies":{"@babel/parser":"^7.28.0","eval-estree-expression":"^3.0.0"},"devDependencies":{"@babel/eslint-parser":"^7.28.0","@babel/eslint-plugin":"^7.27.1","eslint":"8.57.0","esprima":"^4.0.1","gulp-format-md":"^2.0.0","mocha":"^9.2.2","prettier":"^3.6.2"},"keywords":["@babel","@babel/parser","6to5","abstract","analysis","ast","babel","clause","compiler","context","context awareness","ecma","ecmascript","es6","esprima","estree","eval","evaluate","expr-eval","expression","function","invoke","javascript","js","match","math","object","operator","parse","parser","parsing","run","safe","safe-eval","static","syntax","tc39","transpile","transpiler","tree","when"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"related":{"list":[]},"reflinks":["estree","eval-estree-expression"]},"_id":"whence@2.1.0","gitHead":"f37fb58236e76518464f07e5960bd5f3279fce54","_nodeVersion":"24.4.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-4UBPMg5mng5KLzdliVQdQ4fJwCdIMXkE8CkoDmGKRy5r8pV9xq+nVgf/sKXpmNEIOtFp7m7v2bFdb7JoLvh+Hg==","shasum":"2640744d3aa43301bcb3e1348c4107039d9fb159","tarball":"https://registry.npmjs.org/whence/-/whence-2.1.0.tgz","fileCount":4,"unpackedSize":22195,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDK7kkL0vC34TpyQTLIw6d484nKtR8YSrQUVZrmspTbcgIgO1ULNK4z5G4fNN0vh0eH7mPa6lAlKXcMguRjts93D1Q="}]},"_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"directories":{},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/whence_2.1.0_1754592072415_0.6143896486909151"},"_hasShrinkwrap":false}},"time":{"created":"2021-09-07T15:09:45.763Z","modified":"2025-08-07T18:41:12.894Z","0.0.1":"2021-09-07T15:09:45.892Z","1.0.0":"2021-09-07T15:17:37.002Z","2.0.0":"2021-09-22T06:40:49.290Z","2.0.1":"2024-06-17T22:44:38.521Z","2.0.2":"2025-02-07T05:06:28.284Z","2.1.0":"2025-08-07T18:41:12.717Z"},"bugs":{"url":"https://github.com/jonschlinkert/whence/issues"},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"license":"MIT","homepage":"https://github.com/jonschlinkert/whence","keywords":["@babel","@babel/parser","6to5","abstract","analysis","ast","babel","clause","compiler","context","context awareness","ecma","ecmascript","es6","esprima","estree","eval","evaluate","expr-eval","expression","function","invoke","javascript","js","match","math","object","operator","parse","parser","parsing","run","safe","safe-eval","static","syntax","tc39","transpile","transpiler","tree","when"],"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/whence.git"},"description":"Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.","maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"readme":"# whence [![NPM version](https://img.shields.io/npm/v/whence.svg?style=flat)](https://www.npmjs.com/package/whence) [![NPM monthly downloads](https://img.shields.io/npm/dm/whence.svg?style=flat)](https://npmjs.org/package/whence) [![NPM total downloads](https://img.shields.io/npm/dt/whence.svg?style=flat)](https://npmjs.org/package/whence)  [![Tests](https://github.com/jonschlinkert/whence/actions/workflows/test.yml/badge.svg)](https://github.com/jonschlinkert/whence/actions/workflows/test.yml)\n\n> Add context awareness to your apps and frameworks by safely evaluating user-defined conditional expressions. Useful for evaluating expressions in config files, prompts, key bindings, completions, templates, and many other user cases.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save whence\n```\n\n## What is whence?\n\nThis libarary doest returneth true if thine 'when' clause doest matcheth the granted context object.\n\n<details>\n<summary><strong>Seriously though, what does this library do?</strong></summary>\n\nWhence uses [eval-estree-expression](https://github.com/jonschlinkert/eval-estree-expression) to _safely evaluate_ user-defined conditional expressions, sometimes referred to as \"when\" clauses.\n\n</details>\n\n<details>\n<summary><strong>Why do I need this?</strong></summary>\n\nAdd _context awareness_ to your apps and frameworks.\n\nConditional expressions are useful in config files, creating prompts, determining key bindings, filtering suggestions and completions, variables in templates and snippets, and many other user cases.\n\nIt's even more useful when those conditional expressions can be evaluated safely.\n\n**Example: configuration files**\n\nFor example, when authoring configuration files for workflows, pipelines, builds, and so on, it's common for developers to define expressions with conditionals to determine if or when a job, task, or step should run based on environment variables, etc. These configurations are typically defined using YAML, JSON or a similar data format, which means that conditional expressions must be written as strings, booleans, or numbers. Whence makes it safe and easy to evaluate these expressions.\n\n**Other use cases**\n\n* Templates and snippets - Use whence to conditionally render files, sections, or variables\n* Completions and suggestions - Use whence to filter completions and suggestions in your text editor or prompt system\n* Key bindings - [VS Code](https://code.visualstudio.com/api/references/when-clause-contexts) and other text editors use `when` clauses or something similar to determine the keybindings to use when a key is pressed.\n\n</details>\n\n<details>\n<summary><strong>How safe is it?</strong></summary>\n\nNo assignment operators, functions, or function calls are allowed by default to make it as safe as possible to evaluate user-defined expressions. To accomplish this, `whence` uses the [eval-estree-expression](https://github.com/jonschlinkert/eval-estree-expression) library, which takes an [estree](https://github.com/estree/estree) expression from [@babel/parser][], [esprima](http://esprima.org), [acorn](https://github.com/acornjs/acorn), or any similar library that parses and returns a valid `estree` expression.\n\n</details>\n\n<details>\n<summary><strong>Why another \"eval\" library?</strong></summary>\n\n**What we found**\n\nEvery other eval library I found had one of the following shortcomings:\n\n* Uses `eval` or Node's `vm` or something similar to evaluate code. This is to risky, or too heavy for our use cases.\n* Functions are either the primary use case or are supported by default. We don't want users to be able to define functions in their config files.\n* Naive attempts to sanitize code before evaluating it\n* Brittle, incomplete, hand-rolled parsers\n\n**What whence does differently**\n\n* Whence takes a valid [estree][] AST for an _expression_, not statements, functions, etc.\n* Although functions are not supported by default, you can enable support if you really need it (see the [eval-estree-expression](https://github.com/jonschlinkert/eval-estree-expression) docs for more details)\n* Special care was taken in [eval-estree-expression](https://github.com/jonschlinkert/eval-estree-expression) to disallow assignment operators, functions, or other potentially malicious code, like setting `__proto__`, `constructor`, `prototype`, or `undefined` as property names on nested properties.\n\n</details>\n\n## Usage\n\n```js\nconst whence = require('whence');\n\n// async usage\nconsole.log(await whence('name =~ /^d.*b$/', { name: 'doowb' })); //=> true\nconsole.log(await whence('amount > 100', { amount: 101 })); //=> true\nconsole.log(await whence('a < b && c > d', { a: 0, b: 1, c: 3, d: 2 })); //=> true\nconsole.log(await whence('platform === \"darwin\"', { platform: process.platform })); //=> true if macOS\nconsole.log(await whence('platform === \"darwin\"', { platform: 'win32' })); //=> false\n\n// sync usage\nconsole.log(whence.sync('name =~ /^d.*b$/', { name: 'doowb' })); //=> true\nconsole.log(whence.sync('amount > 100', { amount: 101 })); //=> true\nconsole.log(whence.sync('a < b && c > d', { a: 0, b: 1, c: 3, d: 2 })); //=> true\nconsole.log(whence.sync('platform === \"darwin\"', { platform: process.platform })); //=> true if macOS\nconsole.log(whence.sync('platform === \"darwin\"', { platform: 'win32' })); //=> false\n```\n\nSee [eval-estree-expression](https://github.com/jonschlinkert/eval-estree-expression) and that project's unit tests for many more examples of the types of expressions that are supported.\n\n## How whence works\n\nWhence's default behavior (and purpose) is to return a boolean. Most implementors will be interested in this library for that reason. However, if you need the evaluated result and do not want values to be cast to booleans, you should probably use [eval-estree-expression](https://github.com/jonschlinkert/eval-estree-expression) directly. For example:\n\n```js\n// whence behavior\nconsole.log(whence.sync('1 + 9')); //=> true\n\n// eval-estree-expression behavior\nconsole.log(whence.sync('1 + 9')); //=> 10\n```\n\n## API\n\n### [equal](index.js#L38)\n\nReturns true if the given value is truthy, or the `value` (\"left\") is\nequal to or contained within the `context` (\"right\") value. This method is\nused by the `whence()` function (the main export), but you can use this\nmethod directly if you don't want the values to be evaluated.\n\n**Params**\n\n* `value` **{any}**: The value to test.\n* `context` **{Object}**: The value to compare against.\n* `parent` **{[type](https://github.com/medikoo/type)}**\n* `returns` **{Boolean}**: Returns true or false.\n\n### [parse](index.js#L138)\n\nParses the given expression string with [@babel/parser][] and returns and AST. You may also an [estree][]-compatible expression AST.\n\n**Params**\n\n* `source` **{String}**: Expression string or an [estree][]-compatible expression AST.\n* `options` **{Object}**\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconst { parse } = require('whence');\n\nconsole.log(parse('platform === \"darwin\"'));\n// Resuls in something like this:\n// Node {\n//   type: 'BinaryExpression',\n//   value: Node { type: 'Identifier', name: 'platform' },\n//   operator: '===',\n//   context: Node {\n//     type: 'StringLiteral',\n//     extra: { rawValue: 'darwin', raw: '\"darwin\"' },\n//     value: 'darwin'\n//   }\n// }\n```\n\n### [whence](index.js#L171)\n\nAsynchronously evaluates the given expression and returns a boolean.\n\n**Params**\n\n* `source` **{String|Object}**: Expression string or an [estree][]-compatible expression AST.\n* `context` **{Object}**\n* `options` **{Object}**\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\nconst whence = require('whence');\n\nconsole.log(await whence('10 < 20')); //=> true\nconsole.log(whence.sync('10 < 20')); //=> true\n```\n\n### [whenceSync](index.js#L204)\n\nSynchronous version of [whence](#whence). Aliased as `whence.sync()`.\n\n**Params**\n\n* `source` **{String|Object}**: Expression string or an [estree][]-compatible expression AST.\n* `context` **{Object}**\n* `options` **{Object}**\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\nconst { whenceSync } = require('whence');\n\nconsole.log(whenceSync('10 < 20')); //=> true\n```\n\n### [compile](index.js#L238)\n\nCompiles the given expression and returns an async function.\n\n**Params**\n\n* `source` **{String|Object}**: Expression string or an [estree][]-compatible expression AST.\n* `options` **{Object}**\n* `returns` **{Function}**: Returns a function that takes a `context` object.\n\n**Example**\n\n```js\nconst { compile } = require('whence');\nconst fn = compile('type === \"foo\"');\n\nconsole.log(await fn({ type: 'foo' })); //=> true\nconsole.log(await fn({ type: 'bar' })); //=> false\n```\n\n### [compileSync](index.js#L264)\n\nSynchronous version of [compile](#compile). This method is also alias as `.compile.sync()`.\n\n**Params**\n\n* `source` **{String|Object}**: Expression string or an [estree][]-compatible expression AST.\n* `options` **{Object}**\n* `returns` **{Function}**: Returns a function that takes a `context` object.\n\n**Example**\n\n```js\nconst { compile } = require('whence');\nconst fn = compile.sync('type === \"foo\"');\n\nconsole.log(fn({ type: 'foo' })); //=> true\nconsole.log(fn({ type: 'bar' })); //=> false\n```\n\n## Options\n\nSupports all options from [eval-estree-expression](https://github.com/jonschlinkert/eval-estree-expression).\n\n### functions\n\nAlthough whence doesn't like functions...\n\n```js\nconsole.log(whence.sync('/[a-c]+/.test(foo)', { foo: 'bbb' })); //=> throws an error\n```\n\nYou can talk whence into evaluating them by setting the `functions` option to true.\n\n```js\nconsole.log(whence.sync('/[a-c]+/.test(foo)', { foo: 'bbb' }, { functions: true })); //=> true\nconsole.log(whence.sync('/[a-c]+/.test(foo)', { foo: 'zzz' }, { functions: true })); //=> false\n```\n\n## Examples\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2025, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on February 07, 2025._\n","readmeFilename":"README.md"}