Comparing version 0.1.2 to 1.0.0
{ | ||
"/Users/dustin/projects/append-if/lib/index.js":{"path":"/Users/dustin/projects/append-if/lib/index.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":2,"7":2,"8":1,"9":9,"10":9,"11":2,"12":7,"13":1,"14":6,"15":2,"16":4},"b":{"1":[0,1],"2":[1,1],"3":[4,5],"4":[9,5],"5":[2,7],"6":[9,8],"7":[1,6],"8":[7,6],"9":[2,4],"10":[1,1],"11":[2,2]},"f":{"1":1,"2":2,"3":9},"fnMap":{"1":{"name":"_interopRequireDefault","line":7,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":37}}},"2":{"name":"defaultCondition","line":15,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":48}}},"3":{"name":"(anonymous_3)","line":29,"loc":{"start":{"line":29,"column":17},"end":{"line":29,"column":49}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":43}},"2":{"start":{"line":5,"column":0},"end":{"line":5,"column":57}},"3":{"start":{"line":7,"column":0},"end":{"line":7,"column":95}},"4":{"start":{"line":7,"column":39},"end":{"line":7,"column":93}},"5":{"start":{"line":15,"column":0},"end":{"line":19,"column":1}},"6":{"start":{"line":16,"column":2},"end":{"line":16,"column":45}},"7":{"start":{"line":18,"column":2},"end":{"line":18,"column":29}},"8":{"start":{"line":29,"column":0},"end":{"line":45,"column":2}},"9":{"start":{"line":30,"column":2},"end":{"line":30,"column":104}},"10":{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},"11":{"start":{"line":33,"column":4},"end":{"line":33,"column":45}},"12":{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},"13":{"start":{"line":37,"column":4},"end":{"line":37,"column":58}},"14":{"start":{"line":40,"column":2},"end":{"line":42,"column":3}},"15":{"start":{"line":41,"column":4},"end":{"line":41,"column":54}},"16":{"start":{"line":44,"column":2},"end":{"line":44,"column":74}}},"branchMap":{"1":{"line":7,"type":"cond-expr","locations":[{"start":{"line":7,"column":70},"end":{"line":7,"column":73}},{"start":{"line":7,"column":76},"end":{"line":7,"column":92}}]},"2":{"line":7,"type":"binary-expr","locations":[{"start":{"line":7,"column":46},"end":{"line":7,"column":49}},{"start":{"line":7,"column":53},"end":{"line":7,"column":67}}]},"3":{"line":30,"type":"cond-expr","locations":[{"start":{"line":30,"column":72},"end":{"line":30,"column":88}},{"start":{"line":30,"column":91},"end":{"line":30,"column":103}}]},"4":{"line":30,"type":"binary-expr","locations":[{"start":{"line":30,"column":18},"end":{"line":30,"column":39}},{"start":{"line":30,"column":43},"end":{"line":30,"column":69}}]},"5":{"line":32,"type":"if","locations":[{"start":{"line":32,"column":2},"end":{"line":32,"column":2}},{"start":{"line":32,"column":2},"end":{"line":32,"column":2}}]},"6":{"line":32,"type":"binary-expr","locations":[{"start":{"line":32,"column":6},"end":{"line":32,"column":32}},{"start":{"line":32,"column":36},"end":{"line":32,"column":68}}]},"7":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":2},"end":{"line":36,"column":2}},{"start":{"line":36,"column":2},"end":{"line":36,"column":2}}]},"8":{"line":36,"type":"binary-expr","locations":[{"start":{"line":36,"column":6},"end":{"line":36,"column":15}},{"start":{"line":36,"column":19},"end":{"line":36,"column":82}}]},"9":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":40,"column":2}},{"start":{"line":40,"column":2},"end":{"line":40,"column":2}}]},"10":{"line":41,"type":"cond-expr","locations":[{"start":{"line":41,"column":23},"end":{"line":41,"column":44}},{"start":{"line":41,"column":47},"end":{"line":41,"column":53}}]},"11":{"line":44,"type":"cond-expr","locations":[{"start":{"line":44,"column":43},"end":{"line":44,"column":64}},{"start":{"line":44,"column":67},"end":{"line":44,"column":73}}]}},"l":{"3":1,"5":1,"7":1,"15":1,"16":2,"18":2,"29":1,"30":9,"32":9,"33":2,"36":7,"37":1,"40":6,"41":2,"44":4}}} | ||
"/Users/dustin/projects/append-if/lib/index.js":{"path":"/Users/dustin/projects/append-if/lib/index.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":2,"7":2,"8":1,"9":9,"10":9,"11":2,"12":7,"13":1,"14":6,"15":2,"16":4},"b":{"1":[0,1],"2":[1,1],"3":[4,5],"4":[9,5],"5":[2,7],"6":[9,8],"7":[1,6],"8":[7,6],"9":[2,4],"10":[1,1],"11":[2,2]},"f":{"1":1,"2":2,"3":9},"fnMap":{"1":{"name":"_interopRequireDefault","line":7,"loc":{"start":{"line":7,"column":0},"end":{"line":7,"column":37}}},"2":{"name":"defaultCondition","line":15,"loc":{"start":{"line":15,"column":23},"end":{"line":15,"column":71}}},"3":{"name":"(anonymous_3)","line":29,"loc":{"start":{"line":29,"column":17},"end":{"line":29,"column":49}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":43}},"2":{"start":{"line":5,"column":0},"end":{"line":5,"column":57}},"3":{"start":{"line":7,"column":0},"end":{"line":7,"column":95}},"4":{"start":{"line":7,"column":39},"end":{"line":7,"column":93}},"5":{"start":{"line":15,"column":0},"end":{"line":19,"column":2}},"6":{"start":{"line":16,"column":2},"end":{"line":16,"column":45}},"7":{"start":{"line":18,"column":2},"end":{"line":18,"column":29}},"8":{"start":{"line":29,"column":0},"end":{"line":45,"column":2}},"9":{"start":{"line":30,"column":2},"end":{"line":30,"column":104}},"10":{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},"11":{"start":{"line":33,"column":4},"end":{"line":33,"column":45}},"12":{"start":{"line":36,"column":2},"end":{"line":38,"column":3}},"13":{"start":{"line":37,"column":4},"end":{"line":37,"column":58}},"14":{"start":{"line":40,"column":2},"end":{"line":42,"column":3}},"15":{"start":{"line":41,"column":4},"end":{"line":41,"column":54}},"16":{"start":{"line":44,"column":2},"end":{"line":44,"column":74}}},"branchMap":{"1":{"line":7,"type":"cond-expr","locations":[{"start":{"line":7,"column":70},"end":{"line":7,"column":73}},{"start":{"line":7,"column":76},"end":{"line":7,"column":92}}]},"2":{"line":7,"type":"binary-expr","locations":[{"start":{"line":7,"column":46},"end":{"line":7,"column":49}},{"start":{"line":7,"column":53},"end":{"line":7,"column":67}}]},"3":{"line":30,"type":"cond-expr","locations":[{"start":{"line":30,"column":72},"end":{"line":30,"column":88}},{"start":{"line":30,"column":91},"end":{"line":30,"column":103}}]},"4":{"line":30,"type":"binary-expr","locations":[{"start":{"line":30,"column":18},"end":{"line":30,"column":39}},{"start":{"line":30,"column":43},"end":{"line":30,"column":69}}]},"5":{"line":32,"type":"if","locations":[{"start":{"line":32,"column":2},"end":{"line":32,"column":2}},{"start":{"line":32,"column":2},"end":{"line":32,"column":2}}]},"6":{"line":32,"type":"binary-expr","locations":[{"start":{"line":32,"column":6},"end":{"line":32,"column":32}},{"start":{"line":32,"column":36},"end":{"line":32,"column":68}}]},"7":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":2},"end":{"line":36,"column":2}},{"start":{"line":36,"column":2},"end":{"line":36,"column":2}}]},"8":{"line":36,"type":"binary-expr","locations":[{"start":{"line":36,"column":6},"end":{"line":36,"column":15}},{"start":{"line":36,"column":19},"end":{"line":36,"column":82}}]},"9":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":2},"end":{"line":40,"column":2}},{"start":{"line":40,"column":2},"end":{"line":40,"column":2}}]},"10":{"line":41,"type":"cond-expr","locations":[{"start":{"line":41,"column":23},"end":{"line":41,"column":44}},{"start":{"line":41,"column":47},"end":{"line":41,"column":53}}]},"11":{"line":44,"type":"cond-expr","locations":[{"start":{"line":44,"column":43},"end":{"line":44,"column":64}},{"start":{"line":44,"column":67},"end":{"line":44,"column":73}}]}},"l":{"3":1,"5":1,"7":1,"15":1,"16":2,"18":2,"29":1,"30":9,"32":9,"33":2,"36":7,"37":1,"40":6,"41":2,"44":4}}} |
@@ -135,3 +135,5 @@ var addSorting = (function () { | ||
if (cols[i].sortable) { | ||
el = getNthColumn(i).querySelector('.sorter'); | ||
// add the click event handler on the th so users | ||
// dont have to click on those tiny arrows | ||
el = getNthColumn(i).querySelector('.sorter').parentElement; | ||
if (el.addEventListener) { | ||
@@ -138,0 +140,0 @@ el.addEventListener('click', ithSorter(i)); |
@@ -1,11 +0,9 @@ | ||
'use strict'; | ||
import babel from 'gulp-babel'; | ||
import babelCompiler from 'babel-core'; | ||
import del from 'del'; | ||
import gulp from 'gulp'; | ||
import eslint from 'gulp-eslint'; | ||
import istanbul from 'gulp-istanbul'; | ||
import jscs from 'gulp-jscs'; | ||
import jshint from 'gulp-jshint'; | ||
import mocha from 'gulp-mocha'; | ||
'use strict' | ||
import babel from 'gulp-babel' | ||
import babelCompiler from 'babel-core' | ||
import del from 'del' | ||
import gulp from 'gulp' | ||
import eslint from 'gulp-eslint' | ||
import istanbul from 'gulp-istanbul' | ||
import mocha from 'gulp-mocha' | ||
@@ -16,29 +14,22 @@ const configFiles = './gulpfile.babel.js' | ||
, destDir = './lib/'; | ||
, destDir = './lib/' | ||
gulp.task('clean', () => del(destDir)); | ||
gulp.task('clean', () => del(destDir)) | ||
gulp.task('lint', ['clean'], () => { | ||
return gulp.src([configFiles, srcFiles, testFiles]) | ||
gulp.task('lint', ['clean'], () => | ||
gulp.src([configFiles, srcFiles, testFiles]) | ||
.pipe(eslint()) | ||
.pipe(eslint.formatEach('./node_modules/eslint-path-formatter')) | ||
.pipe(eslint.failOnError()) | ||
.pipe(jscs()) | ||
.pipe(jscs.reporter()) | ||
.pipe(jscs.reporter('fail')) | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter('default')) | ||
.pipe(jshint.reporter('fail')); | ||
}); | ||
) | ||
gulp.task('compile', ['lint'], () => { | ||
return gulp.src(srcFiles) | ||
gulp.task('compile', ['lint'], () => | ||
gulp.src(srcFiles) | ||
.pipe(babel()) | ||
.pipe(gulp.dest(destDir)); | ||
}); | ||
.pipe(gulp.dest(destDir)) | ||
) | ||
gulp.task('build', ['compile']); | ||
gulp.task('build', ['compile']) | ||
gulp.task('test', ['build'], cb => { | ||
gulp.src([destDir + '*.js']) | ||
gulp.src([`${destDir}*.js`]) | ||
.pipe(istanbul()) | ||
@@ -54,4 +45,4 @@ .pipe(istanbul.hookRequire()) | ||
.pipe(istanbul.writeReports()) | ||
.on('end', cb); | ||
}); | ||
}); | ||
.on('end', cb) | ||
}) | ||
}) |
@@ -15,7 +15,7 @@ 'use strict'; | ||
*/ | ||
function defaultCondition(string, appendString) { | ||
var defaultCondition = function defaultCondition(string, appendString) { | ||
var regex = new RegExp(appendString + '$'); | ||
return !regex.test(string); | ||
} | ||
}; | ||
@@ -22,0 +22,0 @@ /** |
{ | ||
"name": "append-if", | ||
"version": "0.1.2", | ||
"version": "1.0.0", | ||
"description": "Append a string, conditionally", | ||
@@ -32,13 +32,11 @@ "main": "lib/index.js", | ||
"del": "^2.0.0", | ||
"eslint-config-dustinspecker": "^0.1.0", | ||
"eslint-path-formatter": "^0.1.1", | ||
"eslint-config-dustinspecker": "^0.4.1", | ||
"eslint-plugin-new-with-error": "^1.1.0", | ||
"eslint-plugin-no-use-extend-native": "^0.3.1", | ||
"gulp": "^3.9.0", | ||
"gulp-babel": "^6.0.0", | ||
"gulp-eslint": "^1.0.0", | ||
"gulp-eslint": "^2.0.0", | ||
"gulp-istanbul": "^0.10.0", | ||
"gulp-jscs": "^3.0.2", | ||
"gulp-jshint": "^1.11.0", | ||
"gulp-mocha": "^2.1.0" | ||
} | ||
} |
/* global describe, it */ | ||
'use strict'; | ||
import appendIf from '../lib/'; | ||
import {expect} from 'chai'; | ||
'use strict' | ||
import appendIf from '../lib/' | ||
import {expect} from 'chai' | ||
describe('append-if', () => { | ||
it('should throw TypeError if string is not a string', () => { | ||
function test() { | ||
appendIf(); | ||
} | ||
const test = () => appendIf() | ||
expect(test).to.throw(TypeError, /Expected a string/); | ||
}); | ||
expect(test).to.throw(TypeError, /Expected a string/) | ||
}) | ||
it('should throw error if appendString is not a string', () => { | ||
function test() { | ||
appendIf('hello'); | ||
} | ||
const test = () => appendIf('hello') | ||
expect(test).to.throw(TypeError, /Expected a string/); | ||
}); | ||
expect(test).to.throw(TypeError, /Expected a string/) | ||
}) | ||
it('should throw TypeError if customCondition is passed but not a function or boolean', () => { | ||
function test() { | ||
appendIf('hello', 'hi', []); | ||
} | ||
const test = () => appendIf('hello', 'hi', []) | ||
expect(test).to.throw(TypeError, /Expected a boolean or function/); | ||
}); | ||
expect(test).to.throw(TypeError, /Expected a boolean or function/) | ||
}) | ||
describe('default condition function', () => { | ||
it('should not append if condition is false', () => { | ||
expect(appendIf('hello', 'lo')).to.eql('hello'); | ||
}); | ||
expect(appendIf('hello', 'lo')).to.eql('hello') | ||
}) | ||
it('should append if condition is true', () => { | ||
expect(appendIf('hello', ' world')).to.eql('hello world'); | ||
}); | ||
}); | ||
expect(appendIf('hello', ' world')).to.eql('hello world') | ||
}) | ||
}) | ||
describe('custom condition function', () => { | ||
function customCondition(string, appendString) { | ||
return string.length > appendString.length; | ||
} | ||
const customCondition = (string, appendString) => string.length > appendString.length | ||
it('should append if customCondition returns true', () => { | ||
expect(appendIf('longer', 'short', customCondition)).to.eql('longershort'); | ||
}); | ||
expect(appendIf('longer', 'short', customCondition)).to.eql('longershort') | ||
}) | ||
it('should not append if customCondition returns false', () => { | ||
expect(appendIf('short', 'longer', customCondition)).to.eql('short'); | ||
}); | ||
}); | ||
expect(appendIf('short', 'longer', customCondition)).to.eql('short') | ||
}) | ||
}) | ||
describe('custom condition boolean', () => { | ||
it('should append if customCondition is true', () => { | ||
expect(appendIf('hello', ' world', true)).to.eql('hello world'); | ||
}); | ||
expect(appendIf('hello', ' world', true)).to.eql('hello world') | ||
}) | ||
it('should not append if customCondition is false', () => { | ||
expect(appendIf('hello', ' world', false)).to.eql('hello'); | ||
}); | ||
}); | ||
}); | ||
expect(appendIf('hello', ' world', false)).to.eql('hello') | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13
1
56299
22
547