Comparing version 1.0.1 to 1.0.4
(function() { | ||
var Consumer = function(str) { | ||
var Consumed = function(str) { | ||
this.str = str; | ||
}; | ||
Consumer.prototype.consumeTill = function(c, inclusive) { | ||
Consumed.prototype._updateString = function(replacement) { | ||
this.str = this.str.replace(replacement, ''); | ||
}; | ||
Consumed.prototype.consumeTill = function(c, inclusive) { | ||
var str = this.str.substring(0, this.str.indexOf(c) + (inclusive ? 1 : 0)); | ||
this.str = this.str.replace(str, ''); | ||
this._updateString(str); | ||
return str; | ||
}; | ||
Consumer.prototype.consume = function(pattern) { | ||
Consumed.prototype.consume = function(pattern) { | ||
var match = this.str.match(pattern); | ||
if (match) { | ||
this.str = this.str.replace(pattern, ''); | ||
this._updateString(pattern); | ||
return match[0]; | ||
@@ -21,6 +25,8 @@ } | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = Consumer; | ||
} else { | ||
window.Consumer = Consumer; | ||
module.exports = Consumed; | ||
} | ||
if (typeof window !== 'undefined') { | ||
window.Consumed = Consumed; | ||
} | ||
})(); |
@@ -1,1 +0,1 @@ | ||
!function(){var a=function(a){this.str=a};a.prototype.consumeTill=function(a,b){var c=this.str.substring(0,this.str.indexOf(a)+(b?1:0));return this.str=this.str.replace(c,""),c},a.prototype.consume=function(a){var b=this.str.match(a);return b?(this.str=this.str.replace(a,""),b[0]):void 0},"object"==typeof module&&module.exports?module.exports=a:window.Consumer=a}(); | ||
!function(){var a=function(a){this.str=a};a.prototype._updateString=function(a){this.str=this.str.replace(a,"")},a.prototype.consumeTill=function(a,b){var c=this.str.substring(0,this.str.indexOf(a)+(b?1:0));return this._updateString(c),c},a.prototype.consume=function(a){var b=this.str.match(a);if(b)return this._updateString(a),b[0]},"object"==typeof module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&(window.Consumed=a)}(); |
@@ -1,17 +0,1 @@ | ||
var tm = require('task-master'); | ||
module.exports = function(grunt) { | ||
tm(grunt, { | ||
jit: { | ||
travis: 'grunt-travis-matrix', | ||
matrix: 'grunt-travis-matrix', | ||
mochacov: 'grunt-mocha-cov' | ||
} | ||
}); | ||
grunt.registerTask('mocha', ['mochaTest:test']); | ||
grunt.registerTask('default', ['jshint:all', 'mocha', 'testem:ci:browser']); | ||
grunt.registerTask('coverage', ['mochacov:html', 'open:coverage']); | ||
grunt.registerTask('ci', ['default', 'travis']); | ||
grunt.registerTask('build', ['clean:dist', 'uglify:dist', 'copy:dist']); | ||
grunt.registerTask('browser', ['testem:run:browser']); | ||
}; | ||
module.exports = require('task-master'); |
{ | ||
"name": "consumed", | ||
"version": "1.0.1", | ||
"version": "1.0.4", | ||
"description": "Easy string consumption", | ||
"main": "index.js", | ||
"main": "lib/consumed.js", | ||
"scripts": { | ||
"test": "grunt" | ||
"test": "grunt", | ||
"codeclimate": "codeclimate-test-reporter < coverage/lcov.info", | ||
"travis": "grunt ci" | ||
}, | ||
@@ -31,31 +33,31 @@ "repository": { | ||
"devDependencies": { | ||
"mocha-lcov-reporter": "0.0.2", | ||
"coffee-script": "~1.9.3", | ||
"codeclimate-test-reporter": "^0.4.0", | ||
"coffee-script": "~1.12.2", | ||
"expect.js": "~0.3.1", | ||
"grunt": "~1.0.1", | ||
"grunt-cli": "^1.2.0", | ||
"grunt-contrib-clean": "~1.0.0", | ||
"grunt-contrib-copy": "~1.0.0", | ||
"grunt-contrib-jshint": "~1.1.0", | ||
"grunt-contrib-uglify": "~2.0.0", | ||
"grunt-contrib-watch": "~1.0.0", | ||
"grunt-mocha-test": "~0.13.2", | ||
"grunt-open": "~0.2.3", | ||
"grunt-shell": "^2.1.0", | ||
"grunt-simple-istanbul": "^3.0.2", | ||
"grunt-testem-mincer": "^0.5.18", | ||
"grunt-travis-matrix": "1.0.0", | ||
"indeed": "~1.1.0", | ||
"jshint-stylish": "~2.2.1", | ||
"mocha": "~3.2.0", | ||
"mocha-given": "~0.1.3", | ||
"indeed": "~1.0.6", | ||
"proxyquire": "~1.5.0", | ||
"jshint-stylish": "~2.0.1", | ||
"grunt-mocha-test": "~0.12.7", | ||
"grunt-travis-matrix": "0.0.5", | ||
"sinon": "~1.15.4", | ||
"mocha": "~2.2.5", | ||
"grunt": "~0.4.5", | ||
"task-master": "~2.2.1", | ||
"grunt-contrib-jshint": "~0.11.2", | ||
"grunt-mocha-cov": "~0.4.0", | ||
"grunt-contrib-watch": "~0.6.1", | ||
"grunt-open": "~0.2.3", | ||
"grunt-contrib-clean": "~0.6.0", | ||
"grunt-contrib-copy": "~0.8.0", | ||
"grunt-contrib-uglify": "~0.9.1", | ||
"grunt-contrib-testem": "~0.5.16", | ||
"expect.js": "~0.3.1" | ||
"mocha-lcov-reporter": "1.2.0", | ||
"proxyquire": "~1.7.10", | ||
"sinon": "~1.17.6", | ||
"task-master": "~2.3.0" | ||
}, | ||
"config": { | ||
"blanket": { | ||
"pattern": [ | ||
"consumed/index.js" | ||
] | ||
} | ||
"dependencies": {}, | ||
"engines": { | ||
"node": ">=4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
[![Build Status](https://travis-ci.org/tandrewnichols/consumed.png)](https://travis-ci.org/tandrewnichols/consumed) [![downloads](http://img.shields.io/npm/dm/consumed.svg)](https://npmjs.org/package/consumed) [![npm](http://img.shields.io/npm/v/consumed.svg)](https://npmjs.org/package/consumed) [![Code Climate](https://codeclimate.com/github/tandrewnichols/consumed/badges/gpa.svg)](https://codeclimate.com/github/tandrewnichols/consumed) [![Test Coverage](https://codeclimate.com/github/tandrewnichols/consumed/badges/coverage.svg)](https://codeclimate.com/github/tandrewnichols/consumed) [![dependencies](https://david-dm.org/tandrewnichols/consumed.png)](https://david-dm.org/tandrewnichols/consumed) ![Size](https://img.shields.io/badge/size-368b-brightgreen.svg) | ||
[![Build Status](https://travis-ci.org/tandrewnichols/consumed.png)](https://travis-ci.org/tandrewnichols/consumed) [![downloads](http://img.shields.io/npm/dm/consumed.svg)](https://npmjs.org/package/consumed) [![npm](http://img.shields.io/npm/v/consumed.svg)](https://npmjs.org/package/consumed) [![Code Climate](https://codeclimate.com/github/tandrewnichols/consumed/badges/gpa.svg)](https://codeclimate.com/github/tandrewnichols/consumed) [![Test Coverage](https://codeclimate.com/github/tandrewnichols/consumed/badges/coverage.svg)](https://codeclimate.com/github/tandrewnichols/consumed) [![dependencies](https://david-dm.org/tandrewnichols/consumed.png)](https://david-dm.org/tandrewnichols/consumed) ![Size](https://img.shields.io/badge/size-446b-brightgreen.svg) | ||
@@ -34,3 +34,3 @@ # consumed | ||
This script is only 368 bytes! | ||
This script is only 446 bytes! | ||
@@ -61,2 +61,2 @@ ### Example | ||
I'll be happy to merge any pull request that adds value and has passing tests. Be sure to add a test both for node and for the browser. Tests are run with `grunt`. | ||
Please see [the contribution guidelines](CONTRIBUTING.md). |
@@ -7,3 +7,3 @@ module.exports = { | ||
cwd: "./", | ||
src: "index.js", | ||
src: "lib/consumed.js", | ||
dest: "dist/", | ||
@@ -10,0 +10,0 @@ rename: function(dest, src) { |
@@ -11,3 +11,3 @@ module.exports = { | ||
}, | ||
all: ['index.js'] | ||
all: ['lib/**/*.js'] | ||
}; |
module.exports = { | ||
browser: { | ||
src: [ | ||
'index.js', | ||
'lib/consumed.js', | ||
'node_modules/mocha-given/browser/mocha-given.js', | ||
@@ -13,8 +13,7 @@ 'test/browser/setup.js', | ||
parallel: 2, | ||
reporter: 'tap', | ||
reporter: 'dot', | ||
launch_in_ci: ['PhantomJS'], | ||
launch_in_dev: ['PhantomJS', 'Chrome'], | ||
reporter: 'dot' | ||
} | ||
} | ||
}; |
module.exports = { | ||
dist: { | ||
src: 'index.js', | ||
src: 'lib/consumed.js', | ||
dest: 'dist/consumed.min.js' | ||
} | ||
}; |
module.exports = { | ||
tests: { | ||
files: ['index.js', 'test/**/*.coffee'], | ||
files: ['lib/**/*.js', 'test/**/*.coffee'], | ||
tasks: ['mocha'], | ||
@@ -5,0 +5,0 @@ options: { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
15710
27
194
24
1