pax_global_header00006660000000000000000000000064124607210210014505gustar00rootroot0000000000000052 comment=aa0f2933322d38cf547ff4c8ced882fbd8422866 filename-regex-2.0.0/000077500000000000000000000000001246072102100143745ustar00rootroot00000000000000filename-regex-2.0.0/.editorconfig000066400000000000000000000004471246072102100170560ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false [test/fixtures/*] insert_final_newline = false trim_trailing_whitespace = false filename-regex-2.0.0/.gitattributes000066400000000000000000000003551246072102100172720ustar00rootroot00000000000000# Enforce Unix newlines *.* text eol=lf *.css text eol=lf *.html text eol=lf *.js text eol=lf *.json text eol=lf *.less text eol=lf *.md text eol=lf *.yml text eol=lf *.jpg binary *.gif binary *.png binary *.jpeg binaryfilename-regex-2.0.0/.gitignore000066400000000000000000000001701246072102100163620ustar00rootroot00000000000000*.sublime-* _gh_pages actual bower_components node_modules npm-debug.log temp test/actual tmp TODO.md vendor *.DS_Store filename-regex-2.0.0/.jshintrc000066400000000000000000000004301246072102100162160ustar00rootroot00000000000000{ "asi": false, "boss": true, "curly": true, "eqeqeq": true, "eqnull": true, "esnext": true, "immed": true, "latedef": true, "laxcomma": false, "newcap": true, "noarg": true, "node": true, "sub": true, "undef": true, "unused": true, "mocha": true }filename-regex-2.0.0/.verb.md000066400000000000000000000013261246072102100157340ustar00rootroot00000000000000# {%= name %} {%= badge("fury") %} > {%= description %} {%= include("install-npm", {save: true}) %} ## Usage ```js var regex = require('{%= name %}'); 'a/b/c/d.min.js'.match(regex()); //=> match[0] = 'd.min.js' 'a/b/c/.dotfile'.match(regex()); //=> match[0] = '.dotfile' ``` ## Run tests Install dev dependencies: ```bash npm i -d && npm test ``` ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %}) ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License {%= copyright() %} {%= license() %} *** {%= include("footer") %} filename-regex-2.0.0/LICENSE000066400000000000000000000020771246072102100154070ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014-2015, Jon Schlinkert 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. filename-regex-2.0.0/README.md000066400000000000000000000020011246072102100156440ustar00rootroot00000000000000# filename-regex [![NPM version](https://badge.fury.io/js/filename-regex.svg)](http://badge.fury.io/js/filename-regex) > Regular expression for matching file names, with or without extension. ## Install with [npm](npmjs.org) ```bash npm i filename-regex --save ``` ## Usage ```js var regex = require('filename-regex'); 'a/b/c/d.min.js'.match(regex()); //=> match[0] = 'd.min.js' 'a/b/c/.dotfile'.match(regex()); //=> match[0] = '.dotfile' ``` ## Run tests Install dev dependencies: ```bash npm i -d && npm test ``` ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/regexps/filename-regex/issues) ## Author **Jon Schlinkert** + [github/jonschlinkert](https://github.com/jonschlinkert) + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright (c) 2015 Jon Schlinkert Released under the MIT license *** _This file was generated by [verb](https://github.com/assemble/verb) on January 24, 2015._ filename-regex-2.0.0/index.js000066400000000000000000000003371246072102100160440ustar00rootroot00000000000000/*! * filename-regex * * Copyright (c) 2014-2015, Jon Schlinkert * Licensed under the MIT license. */ module.exports = function filenameRegex() { return /([^\\\/]+)$/; }; filename-regex-2.0.0/package.json000066400000000000000000000016061246072102100166650ustar00rootroot00000000000000{ "name": "filename-regex", "description": "Regular expression for matching file names, with or without extension.", "version": "2.0.0", "homepage": "https://github.com/regexps/filename-regex", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "repository": { "type": "git", "url": "git://github.com/regexps/filename-regex.git" }, "bugs": { "url": "https://github.com/regexps/filename-regex/issues" }, "license": { "type": "MIT", "url": "https://github.com/regexps/filename-regex/blob/master/LICENSE-MIT" }, "main": "index.js", "engines": { "node": ">=0.10.0" }, "files": ["index.js"], "scripts": { "test": "mocha -R spec" }, "keywords": [ "basename", "regular expression", "file", "filename", "filepath", "match", "name", "path", "regex", "regexp" ] } filename-regex-2.0.0/test.js000066400000000000000000000023301246072102100157070ustar00rootroot00000000000000/*! * filename-regex * * Copyright (c) 2014-2015, Jon Schlinkert * Licensed under the MIT License */ 'use strict'; var assert = require('assert'); var re = require('./'); function match(str) { var res = str.match(re()) return res && res[0]; } it('should match the last part of a file path:', function () { assert.equal(match(''), null); assert.equal(match('a'), 'a'); assert.equal(match('a/b'), 'b'); assert.equal(match('a/b/c/d'), 'd'); assert.equal(match('a\\b\\c\\d'), 'd'); }); it('should match a filename with an extension:', function () { assert.equal(match('abc/xyz.md'), 'xyz.md'); assert.equal(match('abc\\xyz.md'), 'xyz.md'); assert.equal(match('b.md'), 'b.md'); }); it('should match a file name that is only a dotfile or file extension:', function () { assert.equal(match('.md'), '.md'); assert.equal(match('.dotfile'), '.dotfile'); assert.equal(match('abc\\.gitignore'), '.gitignore'); assert.equal(match('abc/.gitignore'), '.gitignore'); }); it('should match the filename when there are dots in the dirname:', function () { assert.equal(match('a/.b/abc.foo.min.js'), 'abc.foo.min.js'); assert.equal(match('a/b.c.d/foo.js'), 'foo.js'); });