id
stringlengths
34
124
type
stringclasses
4 values
prompt
stringlengths
0
4.95k
response
stringlengths
21
4.89k
source_lang
stringclasses
3 values
target_lang
stringclasses
2 values
repo
stringclasses
75 values
path
stringlengths
10
88
license
stringclasses
1 value
commit
stringlengths
40
40
stars
int64
431
18.7k
source_url
stringlengths
86
176
line_start
int64
1
214
line_end
int64
3
253
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:3:raw_corpus
raw_corpus
assert.deepEqual r, {root: {}}) 'test default empty tag result': skeleton(undefined, (r) -> assert.deepEqual r['emptytest'], {}) 'test empty tag result specified null': skeleton({emptyTag: null}, (r) -> assert.equal r['emptytest'], null) 'test parse with custom char and attribute object keys': skeleton...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
fd39560b891ad04b3d6b1086eb96e8b2e937288b
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/fd39560b891ad04b3d6b1086eb96e8b2e937288b/test/xml2js.test.coffee
73
98
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:3:completion
completion
assert.deepEqual r, {root: {}}) 'test default empty tag result': skeleton(undefined, (r) -> assert.deepEqual r['emptytest'], {}) 'test empty tag result specified null': skeleton({emptyTag: null}, (r) -> assert.equal r['emptytest'], null) 'test parse with custom char and attribute object keys': skeleton...
assert.equal r['cdatatest']['charobj'], 'CDATA here!' assert.equal r['nochartest']['attrobj']['desc'], 'No data' assert.equal r['nochartest']['attrobj']['misc'], 'false') 'test child node with explicitArray false': skeleton({explicitArray: false}, (r) -> assert.equal r['arraytest']['item'][0]['subitem'],...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
fd39560b891ad04b3d6b1086eb96e8b2e937288b
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/fd39560b891ad04b3d6b1086eb96e8b2e937288b/test/xml2js.test.coffee
73
98
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:3:raw_corpus
raw_corpus
assert.deepEqual r, {root: {}}) 'test default empty tag result': skeleton(undefined, (r) -> assert.deepEqual r['emptytest'], {}) 'test empty tag result specified null': skeleton({emptyTag: null}, (r) -> assert.equal r['emptytest'], null) 'test parse with custom char and attribute object keys': skeleton...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
4df6efc409a9420f7f6788e8da56fb44bc9d59e8
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/4df6efc409a9420f7f6788e8da56fb44bc9d59e8/test/xml2js.test.coffee
73
88
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:3:completion
completion
assert.deepEqual r, {root: {}}) 'test default empty tag result': skeleton(undefined, (r) -> assert.deepEqual r['emptytest'], {}) 'test empty tag result specified null': skeleton({emptyTag: null}, (r) -> assert.equal r['emptytest'], null)
'test parse with custom char and attribute object keys': skeleton({attrkey: 'attrobj', charkey: 'charobj'}, (r) -> assert.equal r['chartest']['attrobj']['desc'], 'Test for CHARs' assert.equal r['chartest']['charobj'], 'Character data here!' assert.equal r['cdatatest']['attrobj']['desc'], 'Test for CDATA' ...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
4df6efc409a9420f7f6788e8da56fb44bc9d59e8
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/4df6efc409a9420f7f6788e8da56fb44bc9d59e8/test/xml2js.test.coffee
73
88
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:3:raw_corpus
raw_corpus
assert.deepEqual r, {root: {}}) 'test default empty tag result': skeleton(undefined, (r) -> assert.deepEqual r['emptytest'], {}) 'test empty tag result specified null': skeleton({emptyTag: null}, (r) -> assert.equal r['emptytest'], null) 'test parse with custom char and attribute object keys': skeleton...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
9a671bfe658eaa6c14c3012f92d67263d1eee383
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/9a671bfe658eaa6c14c3012f92d67263d1eee383/test/xml2js.test.coffee
73
88
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:3:completion
completion
assert.deepEqual r, {root: {}}) 'test default empty tag result': skeleton(undefined, (r) -> assert.deepEqual r['emptytest'], {}) 'test empty tag result specified null': skeleton({emptyTag: null}, (r) -> assert.equal r['emptytest'], null)
'test parse with custom char and attribute object keys': skeleton({attrkey: 'attrobj', charkey: 'charobj'}, (r) -> assert.equal r['chartest']['attrobj']['desc'], 'Test for CHARs' assert.equal r['chartest']['charobj'], 'Character data here!' assert.equal r['cdatatest']['attrobj']['desc'], 'Test for CDATA' ...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
9a671bfe658eaa6c14c3012f92d67263d1eee383
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/9a671bfe658eaa6c14c3012f92d67263d1eee383/test/xml2js.test.coffee
73
88
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:raw_corpus
raw_corpus
# use zap to run tests, it also detects CoffeeScript files xml2js = require '../lib/xml2js' fs = require 'fs' sys = require 'sys' assert = require 'assert' path = require 'path' skeleton = (options, checks) -> (test) -> xmlString = options?.__xmlString delete options?.__xmlString x2js = new xml2js.Parser...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e024b03581b1a8cbe7772b71f328d66800b70d80
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:completion
completion
# use zap to run tests, it also detects CoffeeScript files xml2js = require '../lib/xml2js' fs = require 'fs' sys = require 'sys' assert = require 'assert' path = require 'path' skeleton = (options, checks) -> (test) -> xmlString = options?.__xmlString delete options?.__xmlString x2js = new xml2js.Parser...
assert.equal r['chartest']['@']['desc'], 'Test for CHARs' assert.equal r['chartest']['#'], 'Character data here!' assert.equal r['cdatatest']['@']['desc'], 'Test for CDATA' assert.equal r['cdatatest']['@']['misc'], 'true' assert.equal r['cdatatest']['#'], 'CDATA here!' assert.equal r['nochartest']['...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e024b03581b1a8cbe7772b71f328d66800b70d80
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e024b03581b1a8cbe7772b71f328d66800b70d80
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/test/xml2js.test.coffee
51
79
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
'test disable normalize and trim': skeleton({normalize: false, trim: false}, (r) -> assert.equal r['whitespacetest']['#'], '\n Line One\n Line Two\n ') 'test default root node eliminiation': skeleton({__xmlString: '<root></root>'}, (r) -> assert.deepEqual r, {}) 'test disabled root node e...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e024b03581b1a8cbe7772b71f328d66800b70d80
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e024b03581b1a8cbe7772b71f328d66800b70d80/test/xml2js.test.coffee
51
79
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
5f54d6963b8a8b57f28dd3a8db2a22a2105837b3
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/5f54d6963b8a8b57f28dd3a8db2a22a2105837b3/test/xml2js.test.coffee
51
76
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
assert.equal r['whitespacetest']['#'], 'Line One\n Line Two') 'test disable normalize and trim': skeleton({normalize: false, trim: false}, (r) -> assert.equal r['whitespacetest']['#'], '\n Line One\n Line Two\n ') 'test default root node eliminiation': skeleton({__xmlString: '<root></r...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
5f54d6963b8a8b57f28dd3a8db2a22a2105837b3
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/5f54d6963b8a8b57f28dd3a8db2a22a2105837b3/test/xml2js.test.coffee
51
76
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
0313fd019bca9630eaeb9504530802241045b205
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/0313fd019bca9630eaeb9504530802241045b205/test/xml2js.test.coffee
51
73
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
'test disable normalize': skeleton({normalize: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One\n Line Two') 'test disable normalize and trim': skeleton({normalize: false, trim: false}, (r) -> assert.equal r['whitespacetest']['#'], '\n Line One\n Line Two\n ') 'test ...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
0313fd019bca9630eaeb9504530802241045b205
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/0313fd019bca9630eaeb9504530802241045b205/test/xml2js.test.coffee
51
73
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
c48995f60a1f4c0a05cd9ad0f8b963c900aa8098
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/c48995f60a1f4c0a05cd9ad0f8b963c900aa8098/test/xml2js.test.coffee
51
70
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem'][3]['#'], 'Foo(4)' assert.equal r['listtest']['item'][1]['#'], 'Qux.' assert.equal r['listtest']['item'][2]['#'], 'Quux.')...
assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable normalize': skeleton({normalize: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One\n Line Two') 'test disable normalize and trim': skeleton({normalize: false, trim: false}, (r) -> assert.equal r['whitespacetest'...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
c48995f60a1f4c0a05cd9ad0f8b963c900aa8098
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/c48995f60a1f4c0a05cd9ad0f8b963c900aa8098/test/xml2js.test.coffee
51
70
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:raw_corpus
raw_corpus
# use zap to run tests, it also detects CoffeeScript files xml2js = require '../lib/xml2js' fs = require 'fs' sys = require 'sys' assert = require 'assert' skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs.rea...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
7dddb3c5049f1b351824e993110569d77148ad2e
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:completion
completion
# use zap to run tests, it also detects CoffeeScript files xml2js = require '../lib/xml2js' fs = require 'fs' sys = require 'sys' assert = require 'assert' skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs.rea...
assert.equal r['listtest']['item'][0]['#'], 'This is character data!' assert.equal r['listtest']['item'][0]['subitem'][0], 'Foo(1)' assert.equal r['listtest']['item'][0]['subitem'][1], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem']...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
7dddb3c5049f1b351824e993110569d77148ad2e
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable trimming': skeleton({trim: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable normalize': skeleton({normalize: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One\n Line T...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
7dddb3c5049f1b351824e993110569d77148ad2e
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/test/xml2js.test.coffee
51
60
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable trimming': skeleton({trim: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two')
'test disable normalize': skeleton({normalize: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One\n Line Two') 'test disable normalize and trim': skeleton({normalize: false, trim: false}, (r) -> assert.equal r['whitespacetest']['#'], '\n Line One\n Line Two\n ')
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
7dddb3c5049f1b351824e993110569d77148ad2e
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/7dddb3c5049f1b351824e993110569d77148ad2e/test/xml2js.test.coffee
51
60
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:raw_corpus
raw_corpus
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
29a619b91708aebf6c78af885fb42dc0b2aad4db
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/29a619b91708aebf6c78af885fb42dc0b2aad4db/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:completion
completion
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
assert.equal r['listtest']['item'][0]['#'], 'This is character data!' assert.equal r['listtest']['item'][0]['subitem'][0], 'Foo(1)' assert.equal r['listtest']['item'][0]['subitem'][1], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem']...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
29a619b91708aebf6c78af885fb42dc0b2aad4db
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/29a619b91708aebf6c78af885fb42dc0b2aad4db/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:raw_corpus
raw_corpus
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e1687bc96b0327db4aedaa136616790593724824
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener...
// use zap to run tests, it also detects CoffeeScript files var assert, fs, skeleton, sys, xml2js; xml2js = require('../lib/xml2js'); fs = require('fs'); sys = require('sys'); assert = require('assert'); skeleton = function(options, checks) { return function(test) { var x2js; x2js = new xml2js.Parser(opt...
CoffeeScript
JavaScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e1687bc96b0327db4aedaa136616790593724824
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // use zap to run tests, it also detects CoffeeScript files var assert, fs, skeleton, sys, xml2js; xml2js = require('../lib/xml2js'); fs = require('fs'); sys = require('sys'); assert = require('assert'); skeleton = function(options, checks) { return function...
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
JavaScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e1687bc96b0327db4aedaa136616790593724824
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:completion
completion
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
assert.equal r['listtest']['item'][0]['#'], 'This is character data!' assert.equal r['listtest']['item'][0]['subitem'][0], 'Foo(1)' assert.equal r['listtest']['item'][0]['subitem'][1], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2], 'Foo(3)' assert.equal r['listtest']['item'][0]['subitem']...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e1687bc96b0327db4aedaa136616790593724824
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['listtest']['item'][2]['#'], 'Quux.' test.finish() fs.readFile __dirname + '/fixtures/sample.xml', (err, data) -> x2js.parseString data 'test default text handling': skeleton(undefined, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable trimming'...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e1687bc96b0327db4aedaa136616790593724824
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/test/xml2js.test.coffee
51
67
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['listtest']['item'][2]['#'], 'Quux.' test.finish() fs.readFile __dirname + '/fixtures/sample.xml', (err, data) -> x2js.parseString data 'test default text handling': skeleton(undefined, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two')
'test disable trimming': skeleton({trim: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable normalize': skeleton({normalize: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One\n Line Two') 'test disable normalize and trim': skeleton({normalize:...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
e1687bc96b0327db4aedaa136616790593724824
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/e1687bc96b0327db4aedaa136616790593724824/test/xml2js.test.coffee
51
67
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['listtest']['item'][2]['#'], 'Quux.' test.finish() fs.readFile __dirname + '/fixtures/sample.xml', (err, data) -> x2js.parseString data 'test default text handling': skeleton(undefined, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable trimming'...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
a039d4b2d66c446091e6a30232e430a65e5168ac
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/a039d4b2d66c446091e6a30232e430a65e5168ac/test/xml2js.test.coffee
51
67
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['listtest']['item'][2]['#'], 'Quux.' test.finish() fs.readFile __dirname + '/fixtures/sample.xml', (err, data) -> x2js.parseString data 'test default text handling': skeleton(undefined, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two')
'test disable trimming': skeleton({trim: false}, (r) -> assert.equal r['whitespacetest']['#'], '\n Line One Line Two\n ') 'test disable normalize': skeleton({normalize: false}, (r) -> assert.equal r['whitespacetest']['#'], 'Line One\n Line Two') 'test disable normalize and trim': skel...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
a039d4b2d66c446091e6a30232e430a65e5168ac
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/a039d4b2d66c446091e6a30232e430a65e5168ac/test/xml2js.test.coffee
51
67
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:raw_corpus
raw_corpus
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
bd1c3fb0a6ba820510329fc9113e6088f7331190
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/bd1c3fb0a6ba820510329fc9113e6088f7331190/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener...
// use zap to run tests, it also detects CoffeeScript files var assert, fs, skeleton, sys, xml2js; xml2js = require('../lib/xml2js'); fs = require('fs'); sys = require('sys'); assert = require('assert'); skeleton = function(options, checks) { return function(test) { var x2js; x2js = new xml2js.Parser(opt...
CoffeeScript
JavaScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
bd1c3fb0a6ba820510329fc9113e6088f7331190
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/bd1c3fb0a6ba820510329fc9113e6088f7331190/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // use zap to run tests, it also detects CoffeeScript files var assert, fs, skeleton, sys, xml2js; xml2js = require('../lib/xml2js'); fs = require('fs'); sys = require('sys'); assert = require('assert'); skeleton = function(options, checks) { return function...
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
JavaScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
bd1c3fb0a6ba820510329fc9113e6088f7331190
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/bd1c3fb0a6ba820510329fc9113e6088f7331190/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:completion
completion
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') skeleton = (options, checks) -> (test) -> x2js = new xml2js.Parser(options) x2js.addListener 'end', (r) -> checks(r) test.finish() fs...
assert.equal r['nochartest']['@']['desc'], 'No data' assert.equal r['nochartest']['@']['misc'], 'false' assert.equal r['listtest']['item'][0]['#'], 'This is character data!' assert.equal r['listtest']['item'][0]['subitem'][0], 'Foo(1)' assert.equal r['listtest']['item'][0]['subitem'][1], 'Foo(2)...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
bd1c3fb0a6ba820510329fc9113e6088f7331190
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/bd1c3fb0a6ba820510329fc9113e6088f7331190/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:raw_corpus
raw_corpus
assert.equal r['listtest']['item'][0]['#'], 'This is character data!' assert.equal r['listtest']['item'][0]['subitem'][0]['#'], 'Foo(1)' assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest'...
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
bd1c3fb0a6ba820510329fc9113e6088f7331190
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/bd1c3fb0a6ba820510329fc9113e6088f7331190/test/xml2js.test.coffee
51
73
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:2:completion
completion
assert.equal r['listtest']['item'][0]['#'], 'This is character data!' assert.equal r['listtest']['item'][0]['subitem'][0]['#'], 'Foo(1)' assert.equal r['listtest']['item'][0]['subitem'][1]['#'], 'Foo(2)' assert.equal r['listtest']['item'][0]['subitem'][2]['#'], 'Foo(3)' assert.equal r['listtest'...
'test default text handling': skeleton(undefined, (r) -> assert.equal r['whitespacetest']['#'], 'Line One Line Two') 'test disable trimming': skeleton({trim: false}, (r) -> assert.equal r['whitespacetest']['#'], '\n Line One Line Two\n ') 'test disable normalize': skeleton({normalize: false}...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
bd1c3fb0a6ba820510329fc9113e6088f7331190
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/bd1c3fb0a6ba820510329fc9113e6088f7331190/test/xml2js.test.coffee
51
73
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:raw_corpus
raw_corpus
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') module.exports = 'test default parse': (test) -> x2js = new xml2js.Parser() x2js.addListener 'end', (r) -> console.log 'Result object: ' + sys....
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
f0685b82a929776528e05c55765b1fb72dda3e94
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/f0685b82a929776528e05c55765b1fb72dda3e94/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') module.exports = 'test default parse': (test) -> x2js = new xml2js.Parser() x2js.addListener...
// use zap to run tests, it also detects CoffeeScript files var assert, fs, sys, xml2js; xml2js = require('../lib/xml2js'); fs = require('fs'); sys = require('sys'); assert = require('assert'); module.exports = { 'test default parse': function(test) { var x2js; x2js = new xml2js.Parser(); x2js.addLis...
CoffeeScript
JavaScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
f0685b82a929776528e05c55765b1fb72dda3e94
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/f0685b82a929776528e05c55765b1fb72dda3e94/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // use zap to run tests, it also detects CoffeeScript files var assert, fs, sys, xml2js; xml2js = require('../lib/xml2js'); fs = require('fs'); sys = require('sys'); assert = require('assert'); module.exports = { 'test default parse': function(test) { va...
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') module.exports = 'test default parse': (test) -> x2js = new xml2js.Parser() x2js.addListener 'end', (r) -> console.log 'Result object: ' + sys....
JavaScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
f0685b82a929776528e05c55765b1fb72dda3e94
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/f0685b82a929776528e05c55765b1fb72dda3e94/test/xml2js.test.coffee
1
50
Leonidas-from-XIV/node-xml2js:test/xml2js.test.coffee:1:completion
completion
# use zap to run tests, it also detects CoffeeScript files xml2js = require('../lib/xml2js') fs = require('fs') sys = require('sys') assert = require('assert') module.exports = 'test default parse': (test) -> x2js = new xml2js.Parser() x2js.addListener 'end', (r) -> console.log 'Result object: ' + sys....
assert.equal r['listtest']['item'][2], 'Quux.' test.finish() fs.readFile __dirname + '/fixtures/sample.xml', (err, data) -> x2js.parseString data 'test parse EXPLICIT_CHARKEY': (test) -> x2js = new xml2js.Parser() x2js.EXPLICIT_CHARKEY = true x2js.addListener 'end', (r) -> assert.e...
CoffeeScript
CoffeeScript
Leonidas-from-XIV/node-xml2js
test/xml2js.test.coffee
MIT
f0685b82a929776528e05c55765b1fb72dda3e94
4,965
https://github.com/Leonidas-from-XIV/node-xml2js/blob/f0685b82a929776528e05c55765b1fb72dda3e94/test/xml2js.test.coffee
1
50
gss/engine:src/document/types/Color.coffee:1:raw_corpus
raw_corpus
# Algorithms are used as they are from chroma.js by Gregor Aisch (BSD License). Command = require '../../engine/Command' class Color extends Command @Keywords: {'transparent', 'currentColor'} constructor: (obj) -> switch typeof obj when 'string' if Color.Keywords[obj] return obj ...
CoffeeScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
1
50
gss/engine:src/document/types/Color.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript # Algorithms are used as they are from chroma.js by Gregor Aisch (BSD License). Command = require '../../engine/Command' class Color extends Command @Keywords: {'transparent', 'currentColor'} constructor: (obj) -> switch typeof obj when 'string' ...
// Algorithms are used as they are from chroma.js by Gregor Aisch (BSD License). var Color, Command; Command = require('../../engine/Command'); Color = (function() { class Color extends Command { constructor(obj) { switch (typeof obj) { case 'string': if (Color.Keywords[obj]) { ...
CoffeeScript
JavaScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
1
50
gss/engine:src/document/types/Color.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript // Algorithms are used as they are from chroma.js by Gregor Aisch (BSD License). var Color, Command; Command = require('../../engine/Command'); Color = (function() { class Color extends Command { constructor(obj) { switch (typeof obj) { case '...
# Algorithms are used as they are from chroma.js by Gregor Aisch (BSD License). Command = require '../../engine/Command' class Color extends Command @Keywords: {'transparent', 'currentColor'} constructor: (obj) -> switch typeof obj when 'string' if Color.Keywords[obj] return obj ...
JavaScript
CoffeeScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
1
50
gss/engine:src/document/types/Color.coffee:1:completion
completion
# Algorithms are used as they are from chroma.js by Gregor Aisch (BSD License). Command = require '../../engine/Command' class Color extends Command @Keywords: {'transparent', 'currentColor'} constructor: (obj) -> switch typeof obj when 'string' if Color.Keywords[obj] return obj ...
t2 = if l < 0.5 then l * (1+s) else l+s-l*s t1 = 2 * l - t2 h /= 360 t3[0] = h + 1/3 t3[1] = h t3[2] = h - 1/3 for i in [0..2] t3[i] += 1 if t3[i] < 0 t3[i] -= 1 if t3[i] > 1 if 6 * t3[i] < 1 c[i] = t1 + (t2 - t1) * 6 * t3[i] ...
CoffeeScript
CoffeeScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
1
50
gss/engine:src/document/types/Color.coffee:2:raw_corpus
raw_corpus
rgba: (r, g, b, a) -> return ['rgba', r, g, b, a] hex: (hex) -> if hex.match /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ if hex.length == 4 or hex.length == 7 hex = hex.substr(1) if hex.length == 3 hex = hex.split("") hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[...
CoffeeScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
51
79
gss/engine:src/document/types/Color.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript rgba: (r, g, b, a) -> return ['rgba', r, g, b, a] hex: (hex) -> if hex.match /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ if hex.length == 4 or hex.length == 7 hex = hex.substr(1) if hex.length == 3 hex = hex.split(""...
({ rgba: function(r, g, b, a) { return ['rgba', r, g, b, a]; }, hex: function(hex) { var a, b, g, r, u; if (hex.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)) { if (hex.length === 4 || hex.length === 7) { hex = hex.substr(1); } if (hex.length === 3) { hex = hex.split("...
CoffeeScript
JavaScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
51
79
gss/engine:src/document/types/Color.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript ({ rgba: function(r, g, b, a) { return ['rgba', r, g, b, a]; }, hex: function(hex) { var a, b, g, r, u; if (hex.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)) { if (hex.length === 4 || hex.length === 7) { hex = hex.substr(1); } ...
rgba: (r, g, b, a) -> return ['rgba', r, g, b, a] hex: (hex) -> if hex.match /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ if hex.length == 4 or hex.length == 7 hex = hex.substr(1) if hex.length == 3 hex = hex.split("") hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[...
JavaScript
CoffeeScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
51
79
gss/engine:src/document/types/Color.coffee:2:completion
completion
rgba: (r, g, b, a) -> return ['rgba', r, g, b, a] hex: (hex) -> if hex.match /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ if hex.length == 4 or hex.length == 7 hex = hex.substr(1) if hex.length == 3 hex = hex.split("") hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[...
return ['rgb', r,g,b] # match rgba hex format, eg #FF000077 if hex.match /^#?([A-Fa-f0-9]{8})$/ if hex.length == 9 hex = hex.substr(1) u = parseInt(hex, 16) r = u >> 24 & 0xFF g = u >> 16 & 0xFF b = u >> 8 & 0xFF a = u & 0xFF return ['rgba',...
CoffeeScript
CoffeeScript
gss/engine
src/document/types/Color.coffee
MIT
be430ea249f8030e11c8e03a8e170dcc8b8cf5fb
2,854
https://github.com/gss/engine/blob/be430ea249f8030e11c8e03a8e170dcc8b8cf5fb/src/document/types/Color.coffee
51
79
abe33/atom-pigments:lib/palette.coffee:1:raw_corpus
raw_corpus
module.exports = class Palette @deserialize: (state) -> new Palette(state.variables) constructor: (@variables=[]) -> getTitle: -> 'Palette' getURI: -> 'pigments://palette' getIconName: -> "pigments" sortedByColor: -> @variables.slice().sort ({color:a}, {color:b}) => @compareColors(a,b) sortedByN...
CoffeeScript
abe33/atom-pigments
lib/palette.coffee
MIT
4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4
518
https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/palette.coffee
1
48
abe33/atom-pigments:lib/palette.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Palette @deserialize: (state) -> new Palette(state.variables) constructor: (@variables=[]) -> getTitle: -> 'Palette' getURI: -> 'pigments://palette' getIconName: -> "pigments" sortedByColor: -> @variables.slice().sort (...
var Palette; module.exports = Palette = class Palette { static deserialize(state) { return new Palette(state.variables); } constructor(variables = []) { this.variables = variables; } getTitle() { return 'Palette'; } getURI() { return 'pigments://palette'; } getIconName() { ret...
CoffeeScript
JavaScript
abe33/atom-pigments
lib/palette.coffee
MIT
4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4
518
https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/palette.coffee
1
48
abe33/atom-pigments:lib/palette.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Palette; module.exports = Palette = class Palette { static deserialize(state) { return new Palette(state.variables); } constructor(variables = []) { this.variables = variables; } getTitle() { return 'Palette'; } getURI() { retu...
module.exports = class Palette @deserialize: (state) -> new Palette(state.variables) constructor: (@variables=[]) -> getTitle: -> 'Palette' getURI: -> 'pigments://palette' getIconName: -> "pigments" sortedByColor: -> @variables.slice().sort ({color:a}, {color:b}) => @compareColors(a,b) sortedByN...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/palette.coffee
MIT
4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4
518
https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/palette.coffee
1
48
abe33/atom-pigments:lib/palette.coffee:1:completion
completion
module.exports = class Palette @deserialize: (state) -> new Palette(state.variables) constructor: (@variables=[]) -> getTitle: -> 'Palette' getURI: -> 'pigments://palette' getIconName: -> "pigments" sortedByColor: -> @variables.slice().sort ({color:a}, {color:b}) => @compareColors(a,b) sortedByN...
compareColors: (a,b) -> [aHue, aSaturation, aLightness] = a.hsl [bHue, bSaturation, bLightness] = b.hsl if aHue < bHue -1 else if aHue > bHue 1 else if aSaturation < bSaturation -1 else if aSaturation > bSaturation 1 else if aLightness < bLightness -1 else i...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/palette.coffee
MIT
4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4
518
https://github.com/abe33/atom-pigments/blob/4bdef2e1ebeaa492a6c353c2fd9e7adecdebadf4/lib/palette.coffee
1
48
abe33/atom-pigments:lib/palette.coffee:1:raw_corpus
raw_corpus
module.exports = class Palette constructor: (@variables=[]) -> sortedByColor: -> @variables.slice().sort ({color:a}, {color:b}) => @compareColors(a,b) sortedByName: -> collator = new Intl.Collator("en-US", numeric: true) @variables.slice().sort ({name:a}, {name:b}) -> collator.compare(a,b) getCol...
CoffeeScript
abe33/atom-pigments
lib/palette.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/palette.coffee
1
34
abe33/atom-pigments:lib/palette.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = class Palette constructor: (@variables=[]) -> sortedByColor: -> @variables.slice().sort ({color:a}, {color:b}) => @compareColors(a,b) sortedByName: -> collator = new Intl.Collator("en-US", numeric: true) @variables.slice().sor...
var Palette; module.exports = Palette = class Palette { constructor(variables = []) { this.variables = variables; } sortedByColor() { return this.variables.slice().sort(({ color: a }, { color: b }) => { return this.compareColors(a, b); }); } sortedByName() { ...
CoffeeScript
JavaScript
abe33/atom-pigments
lib/palette.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/palette.coffee
1
34
abe33/atom-pigments:lib/palette.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Palette; module.exports = Palette = class Palette { constructor(variables = []) { this.variables = variables; } sortedByColor() { return this.variables.slice().sort(({ color: a }, { color: b }) => { return this....
module.exports = class Palette constructor: (@variables=[]) -> sortedByColor: -> @variables.slice().sort ({color:a}, {color:b}) => @compareColors(a,b) sortedByName: -> collator = new Intl.Collator("en-US", numeric: true) @variables.slice().sort ({name:a}, {name:b}) -> collator.compare(a,b) getCol...
JavaScript
CoffeeScript
abe33/atom-pigments
lib/palette.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/palette.coffee
1
34
abe33/atom-pigments:lib/palette.coffee:1:completion
completion
module.exports = class Palette constructor: (@variables=[]) -> sortedByColor: -> @variables.slice().sort ({color:a}, {color:b}) => @compareColors(a,b) sortedByName: -> collator = new Intl.Collator("en-US", numeric: true) @variables.slice().sort ({name:a}, {name:b}) -> collator.compare(a,b) getCol...
compareColors: (a,b) -> [aHue, aSaturation, aLightness] = a.hsl [bHue, bSaturation, bLightness] = b.hsl if aHue < bHue -1 else if aHue > bHue 1 else if aSaturation < bSaturation -1 else if aSaturation > bSaturation 1 else if aLightness < bLightness -1 else i...
CoffeeScript
CoffeeScript
abe33/atom-pigments
lib/palette.coffee
MIT
6b9b5368e8a617bbb73ccdb1da96350aba9fd444
518
https://github.com/abe33/atom-pigments/blob/6b9b5368e8a617bbb73ccdb1da96350aba9fd444/lib/palette.coffee
1
34
yakyak/yakyak:src/ui/models/userinput.coffee:1:raw_corpus
raw_corpus
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType,ClientDeliveryMediumType} = require 'hangupsjs' viewstate = require './viewstate' conv = require './conv' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first...
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd
3,762
https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:completion
completion
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType,ClientDeliveryMediumType} = require 'hangupsjs' viewstate = require './viewstate' conv = require './conv' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first...
mb.linebreak() unless index is last null buildChatMessage = (sender, txt) -> conv_id = viewstate.selectedConv conversation_state = conv[conv_id]?.self_conversation_state delivery_medium = ClientDeliveryMediumType[conversation_state?.delivery_medium_option?[0]?.delivery_medium?.delivery_medium_type] ...
CoffeeScript
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd
3,762
https://github.com/yakyak/yakyak/blob/8f8cbc081c66ca00b5e9520a9bef5f2bc1d64dfd/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:raw_corpus
raw_corpus
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType,ClientDeliveryMediumType} = require 'hangupsjs' viewstate = require './viewstate' conv = require './conv' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first...
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
c5c853f776ac6c8a546959055afdf8beff3c097f
3,762
https://github.com/yakyak/yakyak/blob/c5c853f776ac6c8a546959055afdf8beff3c097f/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:completion
completion
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType,ClientDeliveryMediumType} = require 'hangupsjs' viewstate = require './viewstate' conv = require './conv' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first...
mb.linebreak() unless index is last null buildChatMessage = (sender, txt) -> conv_id = viewstate.selectedConv conversation_state = conv[conv_id]?.self_conversation_state delivery_medium = ClientDeliveryMediumType[conversation_state?.delivery_medium_option?[0]?.delivery_medium?.delivery_medium_type] ...
CoffeeScript
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
c5c853f776ac6c8a546959055afdf8beff3c097f
3,762
https://github.com/yakyak/yakyak/blob/c5c853f776ac6c8a546959055afdf8beff3c097f/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:raw_corpus
raw_corpus
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType,ClientDeliveryMediumType} = require 'hangupsjs' viewstate = require './viewstate' conv = require './conv' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first...
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
3d3e400be1de8e5eb264eff43d2e54dae58f3490
3,762
https://github.com/yakyak/yakyak/blob/3d3e400be1de8e5eb264eff43d2e54dae58f3490/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:completion
completion
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType,ClientDeliveryMediumType} = require 'hangupsjs' viewstate = require './viewstate' conv = require './conv' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first...
mb.linebreak() unless index is last null buildChatMessage = (sender, txt) -> conv_id = viewstate.selectedConv conversation_state = conv[conv_id]?.self_conversation_state delivery_medium = ClientDeliveryMediumType[conversation_state?.delivery_medium_option[0]?.delivery_medium?.delivery_medium_type] ...
CoffeeScript
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
3d3e400be1de8e5eb264eff43d2e54dae58f3490
3,762
https://github.com/yakyak/yakyak/blob/3d3e400be1de8e5eb264eff43d2e54dae58f3490/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:raw_corpus
raw_corpus
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType} = require 'hangupsjs' viewstate = require './viewstate' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first = str.substr 0, start last = str.substr start...
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
2666e7f30250a19572a83a34b070e8952e46292e
3,762
https://github.com/yakyak/yakyak/blob/2666e7f30250a19572a83a34b070e8952e46292e/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:completion
completion
urlRegexp = require 'uber-url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType} = require 'hangupsjs' viewstate = require './viewstate' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first = str.substr 0, start last = str.substr start...
mb.linebreak() unless index is last null buildChatMessage = (sender, txt) -> conv_id = viewstate.selectedConv action = null if /^\/me\s/.test txt txt = txt.replace /^\/me/, sender.first_name action = MessageActionType.ME_ACTION mb = new MessageBuilder(action) parse mb, txt s...
CoffeeScript
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
2666e7f30250a19572a83a34b070e8952e46292e
3,762
https://github.com/yakyak/yakyak/blob/2666e7f30250a19572a83a34b070e8952e46292e/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:raw_corpus
raw_corpus
urlRegexp = require 'url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType} = require 'hangupsjs' viewstate = require './viewstate' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first = str.substr 0, start last = str.substr start + to...
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
650e8cf00ed842aaa346fdb26f3e6075d0ee16d4
3,762
https://github.com/yakyak/yakyak/blob/650e8cf00ed842aaa346fdb26f3e6075d0ee16d4/src/ui/models/userinput.coffee
1
50
yakyak/yakyak:src/ui/models/userinput.coffee:1:completion
completion
urlRegexp = require 'url-regex' {MessageBuilder, OffTheRecordStatus,MessageActionType} = require 'hangupsjs' viewstate = require './viewstate' randomid = -> Math.round Math.random() * Math.pow(2,32) split_first = (str, token) -> start = str.indexOf token first = str.substr 0, start last = str.substr start + to...
mb.linebreak() unless index is last null buildChatMessage = (sender, txt) -> conv_id = viewstate.selectedConv action = null if /^\/me\s/.test txt txt = txt.replace /^\/me/, sender.first_name action = MessageActionType.ME_ACTION mb = new MessageBuilder(action) parse mb, txt s...
CoffeeScript
CoffeeScript
yakyak/yakyak
src/ui/models/userinput.coffee
MIT
650e8cf00ed842aaa346fdb26f3e6075d0ee16d4
3,762
https://github.com/yakyak/yakyak/blob/650e8cf00ed842aaa346fdb26f3e6075d0ee16d4/src/ui/models/userinput.coffee
1
50
lmaccherone/node-localstorage:LocalStorage.coffee:2:raw_corpus
raw_corpus
_rm = (target) -> if fs.statSync(target).isDirectory() _emptyDirectory(target) fs.rmdirSync(target) else fs.unlinkSync(target)
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
8
13
lmaccherone/node-localstorage:LocalStorage.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript _rm = (target) -> if fs.statSync(target).isDirectory() _emptyDirectory(target) fs.rmdirSync(target) else fs.unlinkSync(target) ```
var _rm; _rm = function(target) { if (fs.statSync(target).isDirectory()) { _emptyDirectory(target); return fs.rmdirSync(target); } else { return fs.unlinkSync(target); } };
CoffeeScript
JavaScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
8
13
lmaccherone/node-localstorage:LocalStorage.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var _rm; _rm = function(target) { if (fs.statSync(target).isDirectory()) { _emptyDirectory(target); return fs.rmdirSync(target); } else { return fs.unlinkSync(target); } }; ```
_rm = (target) -> if fs.statSync(target).isDirectory() _emptyDirectory(target) fs.rmdirSync(target) else fs.unlinkSync(target)
JavaScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
8
13
lmaccherone/node-localstorage:LocalStorage.coffee:2:completion
completion
_rm = (target) -> if fs.statSync(target).isDirectory() _emptyDirectory(target)
fs.rmdirSync(target) else fs.unlinkSync(target)
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
8
13
lmaccherone/node-localstorage:LocalStorage.coffee:3:raw_corpus
raw_corpus
class QUOTA_EXCEEDED_ERR extends Error constructor: (@message = 'Unknown error.') -> if Error.captureStackTrace? Error.captureStackTrace(this, @constructor) @name = @constructor.name toString: () -> return "#{@name}: #{@message}"
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
15
22
lmaccherone/node-localstorage:LocalStorage.coffee:3:completion
completion
class QUOTA_EXCEEDED_ERR extends Error constructor: (@message = 'Unknown error.') -> if Error.captureStackTrace? Error.captureStackTrace(this, @constructor)
@name = @constructor.name toString: () -> return "#{@name}: #{@message}"
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
15
22
lmaccherone/node-localstorage:LocalStorage.coffee:5:raw_corpus
raw_corpus
class LocalStorage extends events.EventEmitter constructor: (@location, @quota = 5 * 1024 * 1024) -> unless this instanceof LocalStorage return new LocalStorage(@location, @quota) @length = 0 # !TODO: Maybe change this to a property with __defineProperty__ @bytesInUse = 0 @keys = [] @metaK...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
29
78
lmaccherone/node-localstorage:LocalStorage.coffee:5:completion
completion
class LocalStorage extends events.EventEmitter constructor: (@location, @quota = 5 * 1024 * 1024) -> unless this instanceof LocalStorage return new LocalStorage(@location, @quota) @length = 0 # !TODO: Maybe change this to a property with __defineProperty__ @bytesInUse = 0 @keys = [] @metaK...
_init: () -> try stat = fs.statSync(@location) if stat? and not stat.isDirectory() throw new Error("A file exists at the location '#{@location}' when trying to create/open localStorage") # At this point, it exists and is definitely a directory. So read it. @bytesInUse = 0 @leng...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
29
78
lmaccherone/node-localstorage:LocalStorage.coffee:6:raw_corpus
raw_corpus
# If it errors, that means it didn't exist, so create it fs.mkdirSync(@location) return setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = enc...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:6:completion
completion
# If it errors, that means it didn't exist, so create it fs.mkdirSync(@location) return setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = enc...
unless existsBeforeSet metaKey = new MetaKey encodedKey,(@keys.push(key))-1 metaKey.size = valueStringLength @metaKeyMap[key] = metaKey @length += 1 @bytesInUse += valueStringLength if hasListeners evnt = new StorageEvent(key, oldValue, value, @eventUrl) this.emit('storage'...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:7:raw_corpus
raw_corpus
return null removeItem: (key) -> key = key.toString() metaKey = @metaKeyMap[key] if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
129
175
lmaccherone/node-localstorage:LocalStorage.coffee:7:completion
completion
return null removeItem: (key) -> key = key.toString() metaKey = @metaKeyMap[key] if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @...
key: (n) -> return @keys[n] clear: () -> _emptyDirectory(@location) @metaKeyMap = createMap() @keys = [] @length = 0 @bytesInUse = 0 if events.EventEmitter.listenerCount(this, 'storage') evnt = new StorageEvent(null, null, null, @eventUrl) this.emit('storage', evnt) getByt...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
129
175
lmaccherone/node-localstorage:LocalStorage.coffee:8:raw_corpus
raw_corpus
class JSONStorage extends LocalStorage setItem: (key, value) -> newValue = JSON.stringify(value) super(key, newValue) getItem: (key) -> return JSON.parse(super(key)) exports.LocalStorage = LocalStorage exports.JSONStorage = JSONStorage exports.QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
177
188
lmaccherone/node-localstorage:LocalStorage.coffee:8:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class JSONStorage extends LocalStorage setItem: (key, value) -> newValue = JSON.stringify(value) super(key, newValue) getItem: (key) -> return JSON.parse(super(key)) exports.LocalStorage = LocalStorage exports.JSONStorage = JSONStorage exports....
var JSONStorage; JSONStorage = class JSONStorage extends LocalStorage { setItem(key, value) { var newValue; newValue = JSON.stringify(value); return super.setItem(key, newValue); } getItem(key) { return JSON.parse(super.getItem(key)); } }; exports.LocalStorage = LocalStorage; exports.JSONSt...
CoffeeScript
JavaScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
177
188
lmaccherone/node-localstorage:LocalStorage.coffee:8:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var JSONStorage; JSONStorage = class JSONStorage extends LocalStorage { setItem(key, value) { var newValue; newValue = JSON.stringify(value); return super.setItem(key, newValue); } getItem(key) { return JSON.parse(super.getItem(key)); } }...
class JSONStorage extends LocalStorage setItem: (key, value) -> newValue = JSON.stringify(value) super(key, newValue) getItem: (key) -> return JSON.parse(super(key)) exports.LocalStorage = LocalStorage exports.JSONStorage = JSONStorage exports.QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR
JavaScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
177
188
lmaccherone/node-localstorage:LocalStorage.coffee:8:completion
completion
class JSONStorage extends LocalStorage setItem: (key, value) -> newValue = JSON.stringify(value) super(key, newValue)
getItem: (key) -> return JSON.parse(super(key)) exports.LocalStorage = LocalStorage exports.JSONStorage = JSONStorage exports.QUOTA_EXCEEDED_ERR = QUOTA_EXCEEDED_ERR
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
b34508cba2eb55b0e5e6c2a24391b0528d69eea4
460
https://github.com/lmaccherone/node-localstorage/blob/b34508cba2eb55b0e5e6c2a24391b0528d69eea4/LocalStorage.coffee
177
188
lmaccherone/node-localstorage:LocalStorage.coffee:5:raw_corpus
raw_corpus
class LocalStorage extends events.EventEmitter constructor: (@location, @quota = 5 * 1024 * 1024) -> unless this instanceof LocalStorage return new LocalStorage(@location, @quota) @length = 0 # !TODO: Maybe change this to a property with __defineProperty__ @bytesInUse = 0 @keys = [] @metaK...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
29
78
lmaccherone/node-localstorage:LocalStorage.coffee:5:completion
completion
class LocalStorage extends events.EventEmitter constructor: (@location, @quota = 5 * 1024 * 1024) -> unless this instanceof LocalStorage return new LocalStorage(@location, @quota) @length = 0 # !TODO: Maybe change this to a property with __defineProperty__ @bytesInUse = 0 @keys = [] @metaK...
_init: () -> if fs.existsSync(@location) unless fs.statSync(@location).isDirectory() throw new Error("A file exists at the location '#{@location}' when trying to create/open localStorage") @bytesInUse = 0 @length = 0 unless fs.existsSync(@location) fs.mkdirSync(@location) retu...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
29
78
lmaccherone/node-localstorage:LocalStorage.coffee:6:raw_corpus
raw_corpus
setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@location, encodedKey) valueString = value.toString() ...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:6:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@l...
({ setItem: function(key, value) { var encodedKey, evnt, existsBeforeSet, filename, hasListeners, metaKey, oldLength, oldValue, valueString, valueStringLength; hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if (hasListeners) { oldValue = this.getItem(key); ...
CoffeeScript
JavaScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:6:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript ({ setItem: function(key, value) { var encodedKey, evnt, existsBeforeSet, filename, hasListeners, metaKey, oldLength, oldValue, valueString, valueStringLength; hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if ...
setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@location, encodedKey) valueString = value.toString() ...
JavaScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:6:completion
completion
setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@location, encodedKey) valueString = value.toString() ...
@bytesInUse += valueStringLength if hasListeners evnt = new StorageEvent(key, oldValue, value, @eventUrl) this.emit('storage', evnt) getItem: (key) -> key = key.toString() metaKey = @metaKeyMap[key] if !!metaKey filename = path.join(@location, metaKey.key) return fs.readFileSy...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:7:raw_corpus
raw_corpus
if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filename = path.join(@location, metaKey.key) @keys.splice...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
129
170
lmaccherone/node-localstorage:LocalStorage.coffee:7:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filena...
var evnt, filename, hasListeners, k, meta, oldValue, ref, v; if (!!metaKey) { hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if (hasListeners) { oldValue = this.getItem(key); } delete this.metaKeyMap[key]; this.length -= 1; this.bytesInUse -= metaKey.size; filen...
CoffeeScript
JavaScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
129
170
lmaccherone/node-localstorage:LocalStorage.coffee:7:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var evnt, filename, hasListeners, k, meta, oldValue, ref, v; if (!!metaKey) { hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if (hasListeners) { oldValue = this.getItem(key); } delete this.metaKeyMap[key]; this....
if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filename = path.join(@location, metaKey.key) @keys.splice...
JavaScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
129
170
lmaccherone/node-localstorage:LocalStorage.coffee:7:completion
completion
if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filename = path.join(@location, metaKey.key) @keys.splice...
clear: () -> _emptyDirectory(@location) @metaKeyMap = createMap() @keys = [] @length = 0 @bytesInUse = 0 if events.EventEmitter.listenerCount(this, 'storage') evnt = new StorageEvent(null, null, null, @eventUrl) this.emit('storage', evnt) getBytesInUse: () -> return @bytesInU...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
11eebb7b8aae3a75183485f532dd46d440f27dcd
460
https://github.com/lmaccherone/node-localstorage/blob/11eebb7b8aae3a75183485f532dd46d440f27dcd/LocalStorage.coffee
129
170
lmaccherone/node-localstorage:LocalStorage.coffee:7:raw_corpus
raw_corpus
if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filename = path.join(@location, metaKey.key) @keys.splice...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
860b954327506823530502966c3dd12496941b5b
460
https://github.com/lmaccherone/node-localstorage/blob/860b954327506823530502966c3dd12496941b5b/LocalStorage.coffee
129
166
lmaccherone/node-localstorage:LocalStorage.coffee:7:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filena...
var evnt, filename, hasListeners, oldValue; if (!!metaKey) { hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if (hasListeners) { oldValue = this.getItem(key); } delete this.metaKeyMap[key]; this.length -= 1; this.bytesInUse -= metaKey.size; filename = path.join(t...
CoffeeScript
JavaScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
860b954327506823530502966c3dd12496941b5b
460
https://github.com/lmaccherone/node-localstorage/blob/860b954327506823530502966c3dd12496941b5b/LocalStorage.coffee
129
166
lmaccherone/node-localstorage:LocalStorage.coffee:7:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var evnt, filename, hasListeners, oldValue; if (!!metaKey) { hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if (hasListeners) { oldValue = this.getItem(key); } delete this.metaKeyMap[key]; this.length -= 1; th...
if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filename = path.join(@location, metaKey.key) @keys.splice...
JavaScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
860b954327506823530502966c3dd12496941b5b
460
https://github.com/lmaccherone/node-localstorage/blob/860b954327506823530502966c3dd12496941b5b/LocalStorage.coffee
129
166
lmaccherone/node-localstorage:LocalStorage.coffee:7:completion
completion
if (!!metaKey) hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) delete @metaKeyMap[key] @length -= 1 @bytesInUse -= metaKey.size filename = path.join(@location, metaKey.key) @keys.splice...
_emptyDirectory(@location) @metaKeyMap = createMap() @keys = [] @length = 0 @bytesInUse = 0 if events.EventEmitter.listenerCount(this, 'storage') evnt = new StorageEvent(null, null, null, @eventUrl) this.emit('storage', evnt) getBytesInUse: () -> return @bytesInUse _deleteLoca...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
860b954327506823530502966c3dd12496941b5b
460
https://github.com/lmaccherone/node-localstorage/blob/860b954327506823530502966c3dd12496941b5b/LocalStorage.coffee
129
166
lmaccherone/node-localstorage:LocalStorage.coffee:6:raw_corpus
raw_corpus
setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@location, encodedKey) valueString = value.toString() ...
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
0b72cffdb00ff303fe46d2616c875051c4930713
460
https://github.com/lmaccherone/node-localstorage/blob/0b72cffdb00ff303fe46d2616c875051c4930713/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:6:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@l...
({ setItem: function(key, value) { var encodedKey, evnt, existsBeforeSet, filename, hasListeners, metaKey, oldLength, oldValue, valueString, valueStringLength; hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if (hasListeners) { oldValue = this.getItem(key); ...
CoffeeScript
JavaScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
0b72cffdb00ff303fe46d2616c875051c4930713
460
https://github.com/lmaccherone/node-localstorage/blob/0b72cffdb00ff303fe46d2616c875051c4930713/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:6:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript ({ setItem: function(key, value) { var encodedKey, evnt, existsBeforeSet, filename, hasListeners, metaKey, oldLength, oldValue, valueString, valueStringLength; hasListeners = events.EventEmitter.listenerCount(this, 'storage'); oldValue = null; if ...
setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@location, encodedKey) valueString = value.toString() ...
JavaScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
0b72cffdb00ff303fe46d2616c875051c4930713
460
https://github.com/lmaccherone/node-localstorage/blob/0b72cffdb00ff303fe46d2616c875051c4930713/LocalStorage.coffee
79
128
lmaccherone/node-localstorage:LocalStorage.coffee:6:completion
completion
setItem: (key, value) -> hasListeners = events.EventEmitter.listenerCount(this, 'storage') oldValue = null if hasListeners oldValue = this.getItem(key) key = key.toString() encodedKey = encodeURIComponent(key) filename = path.join(@location, encodedKey) valueString = value.toString() ...
@bytesInUse += valueStringLength if hasListeners evnt = new StorageEvent(key, oldValue, value, @eventUrl) this.emit('storage', evnt) getItem: (key) -> key = key.toString() console.log('keys' + @length) metaKey = @metaKeyMap[key] if !!metaKey filename = path.join(@location, metaK...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
LocalStorage.coffee
MIT
0b72cffdb00ff303fe46d2616c875051c4930713
460
https://github.com/lmaccherone/node-localstorage/blob/0b72cffdb00ff303fe46d2616c875051c4930713/LocalStorage.coffee
79
128