├── .gitattributes ├── test ├── fixtures │ ├── hello.txt │ └── hello.min.txt ├── .jshintrc ├── rename-sourcemap.spec.js ├── spec-helper.js ├── path-parsing.spec.js └── rename.spec.js ├── .gitignore ├── .travis.yml ├── .jscsrc ├── .jshintrc ├── .editorconfig ├── LICENSE ├── package.json ├── index.js └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /test/fixtures/hello.txt: -------------------------------------------------------------------------------- 1 | Hello -------------------------------------------------------------------------------- /test/fixtures/hello.min.txt: -------------------------------------------------------------------------------- 1 | Hello -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | temp/ 4 | -------------------------------------------------------------------------------- /test/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../.jshintrc", 3 | "mocha": true 4 | } 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.10 4 | - 0.11 5 | - 0.12 6 | - iojs 7 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "validateIndentation": 2, 3 | "validateQuoteMarks": "'", 4 | "requireSpacesInFunctionExpression": { 5 | "beforeOpeningCurlyBrace": true, 6 | "beforeOpeningRoundBrace": true 7 | }, 8 | "requireSemicolons": true, 9 | "requireLineFeedAtFileEnd": true, 10 | "disallowQuotedKeysInObjects": true, 11 | "disallowMultipleLineStrings": true, 12 | "disallowMultipleSpaces": true 13 | } 14 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 2, 10 | "latedef": true, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "single", 14 | "regexp": true, 15 | "undef": true, 16 | "unused": true, 17 | "strict": true, 18 | "trailing": true, 19 | "smarttabs": true, 20 | "white": true 21 | } 22 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 2 12 | 13 | # We recommend you to keep these unchanged 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.md] 20 | trim_trailing_whitespace = false 21 | 22 | [test/fixtures/*] 23 | insert_final_newline = false 24 | trim_trailing_whitespace = false 25 | -------------------------------------------------------------------------------- /test/rename-sourcemap.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var rename = require('../index'); 4 | var gutil = require('gulp-util'); 5 | var sourceMaps = require('gulp-sourcemaps'); 6 | require('should'); 7 | 8 | describe('gulp-rename', function () { 9 | 10 | context('when file has source map', function () { 11 | 12 | it ('updates source map file to match relative path of renamed file', function (done) { 13 | 14 | var init = sourceMaps.init(); 15 | var stream = init 16 | .pipe(rename({ prefix: 'test-' })) 17 | .pipe(rename({ prefix: 'test-' })); 18 | 19 | stream.on('data', function (file) { 20 | file.sourceMap.file.should.equal('test-test-fixture.css'); 21 | file.sourceMap.file.should.equal(file.relative); 22 | done(); 23 | }); 24 | 25 | init.write(new gutil.File({ 26 | base: 'fixtures', 27 | path: 'fixtures/fixture.css', 28 | contents: new Buffer('') 29 | })); 30 | 31 | init.end(); 32 | 33 | }); 34 | 35 | }); 36 | 37 | }); 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Hector Guillermo Parra Alvarez 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gulp-rename", 3 | "version": "1.2.2", 4 | "description": "Rename files", 5 | "keywords": [ 6 | "gulpplugin" 7 | ], 8 | "homepage": "https://github.com/hparra/gulp-rename", 9 | "bugs": "https://github.com/hparra/gulp-rename/issues", 10 | "author": { 11 | "name": "Hector Guillermo Parra Alvarez", 12 | "email": "hector@hectorparra.com", 13 | "url": "https://github.com/hparra" 14 | }, 15 | "main": "./index.js", 16 | "files": [ 17 | "index.js" 18 | ], 19 | "repository": { 20 | "type": "git", 21 | "url": "git://github.com/hparra/gulp-rename.git" 22 | }, 23 | "scripts": { 24 | "pretest": "jscs index.js test/ && jshint index.js test/", 25 | "test": "mocha" 26 | }, 27 | "devDependencies": { 28 | "gulp": ">=3.0.0", 29 | "gulp-sourcemaps": "^1.5.0", 30 | "gulp-util": "^3.0.4", 31 | "jscs": "^1.12.0", 32 | "jshint": "^2.6.3", 33 | "map-stream": ">=0.0.4", 34 | "mocha": ">=1.15.0", 35 | "should": ">=2.1.0" 36 | }, 37 | "engines": { 38 | "node": ">=0.10.0", 39 | "npm": ">=1.2.10" 40 | }, 41 | "license": "MIT" 42 | } 43 | -------------------------------------------------------------------------------- /test/spec-helper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('should'); 4 | require('mocha'); 5 | 6 | var Path = require('path'), 7 | gulp = require('gulp'), 8 | rename = require('../'); 9 | 10 | global.helper = function (srcArgs, obj, expectedPath, done) { 11 | var srcPattern = srcArgs.pattern || srcArgs; 12 | var srcOptions = srcArgs.options || {}; 13 | var stream = gulp.src(srcPattern, srcOptions).pipe(rename(obj)); 14 | var count = 0; 15 | stream.on('error', done); 16 | stream.on('data', function () { 17 | count++; 18 | }); 19 | if (expectedPath) { 20 | stream.on('data', function (file) { 21 | var resolvedExpectedPath = Path.resolve(expectedPath); 22 | var resolvedActualPath = Path.join(file.base, file.relative); 23 | resolvedActualPath.should.equal(resolvedExpectedPath); 24 | }); 25 | } 26 | stream.on('end', function () { 27 | count.should.be.greaterThan(0); 28 | done.apply(this, arguments); 29 | }); 30 | }; 31 | 32 | global.helperError = function (srcPattern, obj, expectedError, done) { 33 | var stream = gulp.src(srcPattern).pipe(rename(obj)); 34 | stream.on('error', function (err) { 35 | err.message.should.equal(expectedError); 36 | done(); 37 | }); 38 | stream.on('data', function () {}); 39 | stream.on('end', done); 40 | }; 41 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Stream = require('stream'); 4 | var Path = require('path'); 5 | 6 | function gulpRename(obj) { 7 | 8 | var stream = new Stream.Transform({objectMode: true}); 9 | 10 | function parsePath(path) { 11 | var extname = Path.extname(path); 12 | return { 13 | dirname: Path.dirname(path), 14 | basename: Path.basename(path, extname), 15 | extname: extname 16 | }; 17 | } 18 | 19 | stream._transform = function (file, unused, callback) { 20 | 21 | var parsedPath = parsePath(file.relative); 22 | var path; 23 | 24 | var type = typeof obj; 25 | 26 | if (type === 'string' && obj !== '') { 27 | 28 | path = obj; 29 | 30 | } else if (type === 'function') { 31 | 32 | obj(parsedPath); 33 | path = Path.join(parsedPath.dirname, parsedPath.basename + parsedPath.extname); 34 | 35 | } else if (type === 'object' && obj !== undefined && obj !== null) { 36 | 37 | var dirname = 'dirname' in obj ? obj.dirname : parsedPath.dirname, 38 | prefix = obj.prefix || '', 39 | suffix = obj.suffix || '', 40 | basename = 'basename' in obj ? obj.basename : parsedPath.basename, 41 | extname = 'extname' in obj ? obj.extname : parsedPath.extname; 42 | 43 | path = Path.join(dirname, prefix + basename + suffix + extname); 44 | 45 | } else { 46 | 47 | callback(new Error('Unsupported renaming parameter type supplied'), undefined); 48 | return; 49 | 50 | } 51 | 52 | file.path = Path.join(file.base, path); 53 | 54 | // Rename sourcemap if present 55 | if (file.sourceMap) { 56 | file.sourceMap.file = file.relative; 57 | } 58 | 59 | callback(null, file); 60 | }; 61 | 62 | return stream; 63 | } 64 | 65 | module.exports = gulpRename; 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gulp-rename 2 | 3 | gulp-rename is a [gulp](https://github.com/wearefractal/gulp) plugin to rename files easily. 4 | 5 | [![NPM](https://nodei.co/npm/gulp-rename.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/gulp-rename/) 6 | 7 | [![build status](https://secure.travis-ci.org/hparra/gulp-rename.svg)](http://travis-ci.org/hparra/gulp-rename) 8 | [![devDependency Status](https://david-dm.org/hparra/gulp-rename/dev-status.svg)](https://david-dm.org/hparra/gulp-rename#info=devDependencies) 9 | 10 | ## Usage 11 | 12 | gulp-rename provides simple file renaming methods. 13 | 14 | ```javascript 15 | var rename = require("gulp-rename"); 16 | 17 | // rename via string 18 | gulp.src("./src/main/text/hello.txt") 19 | .pipe(rename("main/text/ciao/goodbye.md")) 20 | .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/goodbye.md 21 | 22 | // rename via function 23 | gulp.src("./src/**/hello.txt") 24 | .pipe(rename(function (path) { 25 | path.dirname += "/ciao"; 26 | path.basename += "-goodbye"; 27 | path.extname = ".md"; 28 | return path; 29 | })) 30 | .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md 31 | 32 | // rename via hash 33 | gulp.src("./src/main/text/hello.txt", { base: process.cwd() }) 34 | .pipe(rename({ 35 | dirname: "main/text/ciao", 36 | basename: "aloha", 37 | prefix: "bonjour-", 38 | suffix: "-hola", 39 | extname: ".md" 40 | })) 41 | .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md 42 | ``` 43 | 44 | **See test/rename.spec.js for more examples and test/path-parsing.spec.js for hairy details.** 45 | 46 | ## Notes 47 | 48 | * `dirname` is the relative path from the base directory set by `gulp.src` to the filename. 49 | * `gulp.src()` uses glob-stream which sets the base to the parent of the first directory glob (`*`, `**`, [], or extglob). `dirname` is the remaining directories or `./` if none. glob-stream versions >= 3.1.0 (used by gulp >= 3.2.2) accept a `base` option, which can be used to explicitly set the base. 50 | * `gulp.dest()` renames the directories between `process.cwd()` and `dirname` (i.e. the base relative to CWD). Use `dirname` to rename the directories matched by the glob or descendents of the base of option. 51 | * `basename` is the filename without the extension like path.basename(filename, path.extname(filename)). 52 | * `extname` is the file extension including the '.' like path.extname(filename). 53 | 54 | ## License 55 | 56 | [MIT License](http://en.wikipedia.org/wiki/MIT_License) 57 | -------------------------------------------------------------------------------- /test/path-parsing.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* global helper */ 3 | 4 | require('./spec-helper'); 5 | var Path = require('path'); 6 | 7 | describe('gulp-rename path parsing', function () { 8 | describe('dirname', function () { 9 | context('when src pattern contains no globs', function () { 10 | it('dirname is \'.\'', function (done) { 11 | var srcPattern = 'test/fixtures/hello.txt'; 12 | var obj = function (path) { 13 | path.dirname.should.equal('.'); 14 | }; 15 | helper(srcPattern, obj, null, done); 16 | }); 17 | }); 18 | 19 | context('when src pattern contains filename glob', function () { 20 | it('dirname is \'.\'', function (done) { 21 | var srcPattern = 'test/fixtures/*.min.txt'; 22 | var obj = function (path) { 23 | path.dirname.should.equal('.'); 24 | }; 25 | helper(srcPattern, obj, null, done); 26 | }); 27 | }); 28 | 29 | var dirnameHelper = function (srcPattern) { 30 | it('dirname is path from directory glob to file', function (done) { 31 | var obj = function (path) { 32 | path.dirname.should.match(/^fixtures[0-9]?$/); 33 | }; 34 | helper(srcPattern, obj, null, done); 35 | }); 36 | }; 37 | 38 | context('when src pattern matches a directory with *', function () { 39 | dirnameHelper('test/*/*.min.txt'); 40 | }); 41 | 42 | context('when src pattern matches a directory with **', function () { 43 | dirnameHelper('test/**/*.min.txt'); 44 | }); 45 | 46 | context('when src pattern matches a directory with [...]', function () { 47 | dirnameHelper('test/fixt[a-z]res/*.min.txt'); 48 | }); 49 | 50 | context('when src pattern matches a directory with {...,...}', function () { 51 | dirnameHelper('test/f{ri,ixtur}es/*.min.txt'); 52 | }); 53 | 54 | /* SKIP: glob2base does not handle brace expansion as expected. See wearefractal/glob2base#1 */ 55 | context.skip('when src pattern matches a directory with {#..#}', function () { 56 | dirnameHelper('test/fixtures{0..9}/*.min.txt'); 57 | }); 58 | 59 | context('when src pattern matches a directory with an extglob', function () { 60 | dirnameHelper('test/f+(ri|ixtur)es/*.min.txt'); 61 | }); 62 | 63 | context('when src pattern includes `base` option', function () { 64 | it('dirname is path from given directory to file', function (done) { 65 | var srcPattern = 'test/**/*.min.txt'; 66 | var srcOptions = {base: process.cwd()}; 67 | var obj = function (path) { 68 | path.dirname.should.equal('test/fixtures'); 69 | }; 70 | helper({pattern: srcPattern, options: srcOptions}, obj, null, done); 71 | }); 72 | }); 73 | }); 74 | 75 | describe('basename', function () { 76 | it('strips extension like Path.basename(path, ext)', function (done) { 77 | var srcPattern = 'test/fixtures/hello.min.txt'; 78 | var obj = function (path) { 79 | path.basename.should.equal('hello.min'); 80 | path.basename.should.equal(Path.basename(srcPattern, Path.extname(srcPattern))); 81 | }; 82 | helper(srcPattern, obj, null, done); 83 | }); 84 | }); 85 | 86 | describe('extname', function () { 87 | it('includes \'.\' like Path.extname', function (done) { 88 | var srcPattern = 'test/fixtures/hello.txt'; 89 | var obj = function (path) { 90 | path.extname.should.equal('.txt'); 91 | path.extname.should.equal(Path.extname(srcPattern)); 92 | }; 93 | helper(srcPattern, obj, null, done); 94 | }); 95 | 96 | it('excludes multiple extensions like Path.extname', function (done) { 97 | var srcPattern = 'test/fixtures/hello.min.txt'; 98 | var obj = function (path) { 99 | path.extname.should.equal('.txt'); 100 | path.extname.should.equal(Path.extname(srcPattern)); 101 | }; 102 | helper(srcPattern, obj, null, done); 103 | }); 104 | }); 105 | }); 106 | -------------------------------------------------------------------------------- /test/rename.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /* global helper, helperError */ 3 | 4 | require('./spec-helper'); 5 | 6 | describe('gulp-rename', function () { 7 | context('with string parameter', function () { 8 | context('when src pattern does not contain directory glob', function () { 9 | it('sets filename to value', function (done) { 10 | var srcPattern = 'test/fixtures/hello.txt'; 11 | var obj = 'hola.md'; 12 | var expectedPath = 'test/fixtures/hola.md'; 13 | helper(srcPattern, obj, expectedPath, done); 14 | }); 15 | }); 16 | context('when src pattern contains directory glob', function () { 17 | it('sets relative path to value', function (done) { 18 | var srcPattern = 'test/**/hello.txt'; 19 | var obj = 'fixtures/hola.md'; 20 | var expectedPath = 'test/fixtures/hola.md'; 21 | helper(srcPattern, obj, expectedPath, done); 22 | }); 23 | }); 24 | }); 25 | 26 | context('with object parameter', function () { 27 | var srcPattern; 28 | beforeEach(function () { 29 | srcPattern = 'test/**/hello.txt'; 30 | }); 31 | 32 | context('with empty object', function () { 33 | it('has no effect', function (done) { 34 | var obj = {}; 35 | var expectedPath = 'test/fixtures/hello.txt'; 36 | helper(srcPattern, obj, expectedPath, done); 37 | }); 38 | }); 39 | 40 | context('with dirname value', function () { 41 | it('replaces dirname with value', function (done) { 42 | var obj = { 43 | dirname: 'elsewhere', 44 | }; 45 | var expectedPath = 'test/elsewhere/hello.txt'; 46 | helper(srcPattern, obj, expectedPath, done); 47 | }); 48 | it('removes dirname with \'./\'', function (done) { 49 | var obj = { 50 | dirname: './', 51 | }; 52 | var expectedPath = 'test/hello.txt'; 53 | helper(srcPattern, obj, expectedPath, done); 54 | }); 55 | it('removes dirname with empty string', function (done) { 56 | var obj = { 57 | dirname: '', 58 | }; 59 | var expectedPath = 'test/hello.txt'; 60 | helper(srcPattern, obj, expectedPath, done); 61 | }); 62 | }); 63 | 64 | context('with prefix value', function () { 65 | it('prepends value to basename', function (done) { 66 | var obj = { 67 | prefix: 'bonjour-', 68 | }; 69 | var expectedPath = 'test/fixtures/bonjour-hello.txt'; 70 | helper(srcPattern, obj, expectedPath, done); 71 | }); 72 | }); 73 | 74 | context('with basename value', function () { 75 | it('replaces basename with value', function (done) { 76 | var obj = { 77 | basename: 'aloha', 78 | }; 79 | var expectedPath = 'test/fixtures/aloha.txt'; 80 | helper(srcPattern, obj, expectedPath, done); 81 | }); 82 | it('removes basename with empty string (for consistency)', function (done) { 83 | var obj = { 84 | prefix: 'aloha', 85 | basename: '', 86 | }; 87 | var expectedPath = 'test/fixtures/aloha.txt'; 88 | helper(srcPattern, obj, expectedPath, done); 89 | }); 90 | }); 91 | 92 | context('with suffix value', function () { 93 | it('appends value to basename', function (done) { 94 | var obj = { 95 | suffix: '-hola', 96 | }; 97 | var expectedPath = 'test/fixtures/hello-hola.txt'; 98 | helper(srcPattern, obj, expectedPath, done); 99 | }); 100 | }); 101 | 102 | context('with extname value', function () { 103 | it('replaces extname with value', function (done) { 104 | var obj = { 105 | extname: '.md', 106 | }; 107 | var expectedPath = 'test/fixtures/hello.md'; 108 | helper(srcPattern, obj, expectedPath, done); 109 | }); 110 | it('removes extname with empty string', function (done) { 111 | var obj = { 112 | extname: '', 113 | }; 114 | var expectedPath = 'test/fixtures/hello'; 115 | helper(srcPattern, obj, expectedPath, done); 116 | }); 117 | }); 118 | }); 119 | 120 | context('with function parameter', function () { 121 | var srcPattern; 122 | beforeEach(function () { 123 | srcPattern = 'test/**/hello.txt'; 124 | }); 125 | 126 | it('receives object with dirname', function (done) { 127 | var obj = function (path) { 128 | path.dirname.should.equal('fixtures'); 129 | path.dirname = 'elsewhere'; 130 | }; 131 | var expectedPath = 'test/elsewhere/hello.txt'; 132 | helper(srcPattern, obj, expectedPath, done); 133 | }); 134 | 135 | it('receives object with basename', function (done) { 136 | var obj = function (path) { 137 | path.basename.should.equal('hello'); 138 | path.basename = 'aloha'; 139 | }; 140 | var expectedPath = 'test/fixtures/aloha.txt'; 141 | helper(srcPattern, obj, expectedPath, done); 142 | }); 143 | 144 | it('receives object with extname', function (done) { 145 | var obj = function (path) { 146 | path.extname.should.equal('.txt'); 147 | path.extname = '.md'; 148 | }; 149 | var expectedPath = 'test/fixtures/hello.md'; 150 | helper(srcPattern, obj, expectedPath, done); 151 | }); 152 | 153 | it('ignores the return value', function (done) { 154 | var obj = function (/*path*/) { 155 | return { 156 | dirname: 'elsewhere', 157 | basename: 'aloha', 158 | extname: '.md' 159 | }; 160 | }; 161 | var expectedPath = 'test/fixtures/hello.txt'; 162 | helper(srcPattern, obj, expectedPath, done); 163 | }); 164 | 165 | it('receives object with extname even if a different value is returned', function (done) { 166 | var obj = function (path) { 167 | path.extname.should.equal('.txt'); 168 | path.extname = '.md'; 169 | }; 170 | var expectedPath = 'test/fixtures/hello.md'; 171 | helper(srcPattern, obj, expectedPath, done); 172 | }); 173 | }); 174 | 175 | context('throws unsupported parameter type', function () { 176 | var srcPattern; 177 | beforeEach(function () { 178 | srcPattern = 'test/**/hello.txt'; 179 | }); 180 | 181 | var UNSUPPORTED_PARAMATER = 'Unsupported renaming parameter type supplied'; 182 | it('with undefined object', function (done) { 183 | var obj; 184 | var expectedError = UNSUPPORTED_PARAMATER; 185 | helperError(srcPattern, obj, expectedError, done); 186 | }); 187 | 188 | it('with null object', function (done) { 189 | var obj = null; 190 | var expectedError = UNSUPPORTED_PARAMATER; 191 | helperError(srcPattern, obj, expectedError, done); 192 | }); 193 | 194 | it('with empty string', function (done) { 195 | var obj = ''; 196 | var expectedError = UNSUPPORTED_PARAMATER; 197 | helperError(srcPattern, obj, expectedError, done); 198 | }); 199 | 200 | it('with boolean value', function (done) { 201 | var obj = true; 202 | var expectedError = UNSUPPORTED_PARAMATER; 203 | helperError(srcPattern, obj, expectedError, done); 204 | }); 205 | 206 | it('with numeric value', function (done) { 207 | var obj = 1; 208 | var expectedError = UNSUPPORTED_PARAMATER; 209 | helperError(srcPattern, obj, expectedError, done); 210 | }); 211 | }); 212 | }); 213 | --------------------------------------------------------------------------------