Comparing version 0.3.4 to 0.3.5
@@ -172,7 +172,5 @@ var mode; | ||
function init() { | ||
editor.connect(function () { | ||
editor.connect().then(function () { | ||
changeExample('jsx:class'); | ||
}, null, { | ||
maxTries: 50 | ||
}); | ||
}) | ||
} | ||
@@ -189,5 +187,7 @@ | ||
mode = id.split(':')[0]; | ||
editor.configure({ | ||
text: EXAMPLES[id], | ||
mode: mode | ||
editor.send({ | ||
editor: { | ||
text: EXAMPLES[id], | ||
mode: mode | ||
} | ||
}); | ||
@@ -203,4 +203,4 @@ } | ||
tabSize = size; | ||
editor.configure({ | ||
tabSize: tabSizeMap[size] | ||
editor.send({ | ||
editor: {tabSize: tabSizeMap[size]} | ||
}); | ||
@@ -210,3 +210,3 @@ } | ||
function indentCode() { | ||
editor.getText(function (e) { | ||
editor.getText().then(function (text) { | ||
var modeMap = { | ||
@@ -225,6 +225,8 @@ 'less': 'css', | ||
}; | ||
editor.configure({ | ||
text: indent[modeMap[mode]](e.data, {tabString: tabStringMap[tabSize]}) | ||
return editor.send({ | ||
editor: { | ||
text: indent[modeMap[mode]](text, {tabString: tabStringMap[tabSize]}) | ||
} | ||
}); | ||
}); | ||
} |
{ | ||
"name": "indent.js", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Fast minimalistic pure indentation of JavaScript, CSS, and HTML.", | ||
@@ -5,0 +5,0 @@ "main": "lib/indent.js", |
@@ -49,3 +49,3 @@ # indent.js - pure code indentation for js, jsx, json, ts, tsx, html, css, less, scss | ||
```javascript | ||
import {indent} from 'indent.js'; | ||
import indent from 'indent.js'; | ||
@@ -52,0 +52,0 @@ var indentedJs = indent.js(code); // JSX as well |
@@ -19,2 +19,14 @@ var sut = require('../../lib/indent').js; | ||
it('if: single line with object and comment', function () { | ||
var expected = ` | ||
if (a) // Test | ||
b = { | ||
c: 0, | ||
d: 1 | ||
} | ||
`; | ||
expect(sut(expected, {tabString: ts})).to.equal( | ||
expected.replace(/\r*\n/g, '\r\n')); | ||
}); | ||
it('if: single line', function () { | ||
@@ -21,0 +33,0 @@ var expected = ` |
@@ -23,2 +23,18 @@ var sut = require('../../lib/indent').js; | ||
}); | ||
}); | ||
it('empty object declaration', function () { | ||
var expected = ` | ||
{ | ||
} | ||
`; | ||
expect(sut(expected, {tabString: ts})).to.equal( | ||
expected.replace(/\r*\n/g, '\r\n')); | ||
}); | ||
it('empty object with brackets', function () { | ||
var expected = `({ | ||
})`; | ||
expect(sut(expected, {tabString: ts})).to.equal( | ||
expected.replace(/\r*\n/g, '\r\n')); | ||
}); | ||
}); |
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
2732
1364776
69