pax_global_header00006660000000000000000000000064126236266310014521gustar00rootroot0000000000000052 comment=84891a397f0703c5234589461adcbb0357a95207 safe-resolve-1.0.0/000077500000000000000000000000001262362663100141125ustar00rootroot00000000000000safe-resolve-1.0.0/.gitignore000066400000000000000000000000141262362663100160750ustar00rootroot00000000000000.nyc_output safe-resolve-1.0.0/.travis.yml000066400000000000000000000001361262362663100162230ustar00rootroot00000000000000language: node_js node_js: - "4" - "5" - "iojs" - "iojs-v1" - "iojs-v2" sudo: false safe-resolve-1.0.0/LICENSE000066400000000000000000000020651262362663100151220ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 Evan Lucas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. safe-resolve-1.0.0/README.md000066400000000000000000000012731262362663100153740ustar00rootroot00000000000000# safe-resolve [![Build Status](https://travis-ci.org/evanlucas/safe-resolve.svg)](https://travis-ci.org/evanlucas/safe-resolve) [![Coverage Status](https://coveralls.io/repos/evanlucas/safe-resolve/badge.svg?branch=master&service=github)](https://coveralls.io/github/evanlucas/safe-resolve?branch=master) `require.resolve` without throwing ## Install ```bash $ npm install --save safe-resolve ``` ## Test ```bash $ npm test ``` ## Usage ```js const safe = require('safe-resolve') // index.js exists safe('./index.js') // returns the resolved filepath // biscuits.js does not exist safe('./biscuits.js') // => null ``` ## Author Evan Lucas ## License MIT (See `LICENSE` for more info) safe-resolve-1.0.0/index.js000066400000000000000000000001751262362663100155620ustar00rootroot00000000000000'use strict' module.exports = function(fp) { try { return require.resolve(fp) } catch (err) { return null } } safe-resolve-1.0.0/package.json000066400000000000000000000010441262362663100163770ustar00rootroot00000000000000{ "name": "safe-resolve", "version": "1.0.0", "description": "require.resolve without throwing", "main": "index.js", "scripts": { "test": "tap test.js --cov" }, "dependencies": {}, "devDependencies": { "tap": "~2.3.0" }, "license": "MIT", "author": "Evan Lucas ", "repository": { "type": "git", "url": "https://github.com/evanlucas/safe-resolve" }, "homepage": "https://github.com/evanlucas/safe-resolve", "bugs": { "url": "https://github.com/evanlucas/safe-resolve/issues" } } safe-resolve-1.0.0/test.js000066400000000000000000000005351262362663100154320ustar00rootroot00000000000000'use strict' const test = require('tap').test const path = require('path') const safe = require('./') test('should work', function(t) { t.plan(1) var fp = path.join(__dirname, 'index.js') var o = safe('./index.js') t.equal(o, fp) }) test('should not throw', function(t) { t.plan(1) var o = safe('./biscuits.js') t.equal(o, null) })