Sha256: 7ef6d2f6e7da4de99cd0730ff8c08ac75c03121ea2fef83bbcd3a59955a96039

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

'use strict';
/*jshint asi: true */

var test = require('trap').test
  , generator = require('inline-source-map')
  , rx = require('..').commentRegex

function comment(s) {
  rx.lastIndex = 0;
  return rx.test(s + 'sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmdW5jdGlvbiBmb28oKSB7XG4gY29uc29sZS5sb2coXCJoZWxsbyBJIGFtIGZvb1wiKTtcbiBjb25zb2xlLmxvZyhcIndobyBhcmUgeW91XCIpO1xufVxuXG5mb28oKTtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9')
}

test('comment regex', function (t) {
  [ '//@ '
  , '  //@ '
  , '\t//@ '
  ].forEach(function (x) { t.ok(comment(x), 'matches ' + x) })

  // if I don't assign this, I get: TypeError: Cannot read property ' @// @' of undefined
  var a = 
  [ '///@ ' 
  , '}}//@ '
  , ' @// @'
  ].forEach(function (x) { t.ok(!comment(x), 'does not match ' + x) })
})

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/convert-source-map/test/comment-regex.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/convert-source-map/test/comment-regex.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/convert-source-map/test/comment-regex.js