mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 10:30:08 +00:00
tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9d67033cc6
commit
5503686e9e
18
object.js
18
object.js
@ -12,11 +12,20 @@ function(require){ var module={} // makes module AMD/node compatible...
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
// Helpers...
|
// Helpers...
|
||||||
|
|
||||||
|
var TAB_SIZE =
|
||||||
|
module.TAB_SIZE = 4
|
||||||
|
|
||||||
// XXX is this the right place for this???
|
// XXX is this the right place for this???
|
||||||
// ...when moving take care that ImageGrid's core.doc uses this...
|
// ...when moving take care that ImageGrid's core.doc uses this...
|
||||||
var normalizeIndent =
|
var normalizeIndent =
|
||||||
module.normalizeIndent =
|
module.normalizeIndent =
|
||||||
function(text){
|
function(text, tab_size){
|
||||||
|
text = TAB_SIZE > 0 ?
|
||||||
|
text.replace(/\t/g,
|
||||||
|
' '.repeat(tab_size === undefined ?
|
||||||
|
tab_size
|
||||||
|
: TAB_SIZE))
|
||||||
|
: text
|
||||||
var lines = text.split(/\n/)
|
var lines = text.split(/\n/)
|
||||||
var l = lines
|
var l = lines
|
||||||
.reduce(function(l, e, i){
|
.reduce(function(l, e, i){
|
||||||
@ -30,8 +39,11 @@ function(text){
|
|||||||
}, -1)
|
}, -1)
|
||||||
return lines
|
return lines
|
||||||
.map(function(line, i){
|
.map(function(line, i){
|
||||||
return i == 0 ? line : line.slice(l) })
|
return i == 0 ?
|
||||||
.join('\n') }
|
line
|
||||||
|
: line.slice(l) })
|
||||||
|
.join('\n')
|
||||||
|
.trim() }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-object",
|
"name": "ig-object",
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "object.js",
|
"main": "object.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user