Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Showing with 8 additions and 5 deletions.
  1. +2 −1  lib/levenshtein.js
  2. +6 −4 {spec → test}/levenshtein.spec.js
View
3  lib/levenshtein.js
@@ -74,5 +74,6 @@ function Levenshtein( str_m, str_n ) { var previous, current, matrix
}
// Export
-module.exports = Levenshtein
+if (typeof module == 'object' && module && module.exports)
+ module.exports = Levenshtein
View
10 spec/levenshtein.spec.js → test/levenshtein.spec.js
@@ -1,7 +1,9 @@
// Tests
-var Levenshtein = require( '../lib/Levenshtein' )
+// Run with `expresso` from the toplevel directory.
+var Levenshtein = require( '../lib/levenshtein' )
+var assert = require( 'assert' )
-exports['test Levenshtein correctness'] = function( assert ) {
+exports['test Levenshtein correctness'] = function() {
var l1 = new Levenshtein( 'kitten', 'sitting' )
, l2 = new Levenshtein( 'Saturday', 'Sunday' )
@@ -9,12 +11,12 @@ exports['test Levenshtein correctness'] = function( assert ) {
assert.equal( 3, l2.distance, 'Saturday <=> Sunday' )
}
-exports['test Levenshtein can be coerced to a number'] = function( assert ) {
+exports['test Levenshtein can be coerced to a number'] = function() {
var l1 = new Levenshtein( 'kitten', 'sitting' )
assert.equal( l1.distance, l1 + 0 )
}
-exports['test Levenshtein can be coerced to a string'] = function( assert ) {
+exports['test Levenshtein can be coerced to a string'] = function() {
var l1 = new Levenshtein( 'kitten', 'sitting' )
assert.equal( l1.inspect(), new String(l1) )
}

No commit comments for this range

Something went wrong with that request. Please try again.