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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
meltingice/psd.js:lib/psd/layer_info/layer_name_source.coffee:1:completion | completion | LayerInfo = require '../layer_info.coffee'
module.exports = class LayerNameSource extends LayerInfo | @shouldParse: (key) -> key is 'lnsr'
parse: ->
@id = @file.readString(4) | CoffeeScript | CoffeeScript | meltingice/psd.js | lib/psd/layer_info/layer_name_source.coffee | MIT | 7e8392d20fd5d66ad70ddda7309661b9a0ca67c8 | 2,846 | https://github.com/meltingice/psd.js/blob/7e8392d20fd5d66ad70ddda7309661b9a0ca67c8/lib/psd/layer_info/layer_name_source.coffee | 1 | 7 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
@SECURITY_MAP:
broadcast: 'canReceive'
config: 'canDiscover'
constructor: (options, dependencies={}) ->
{@emitterUuid, @ty... | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 6934fed7ad8859101f0073d865cc2f820dcc608f | 815 | https://github.com/octoblu/meshblu/blob/6934fed7ad8859101f0073d865cc2f820dcc608f/lib/SubscriptionGetter.coffee | 1 | 50 | ||
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
@SECURITY_MAP:
broadcast: 'canReceive'
config: 'canDiscover'
construc... | var SimpleAuth, SubscriptionGetter, _, async, debug;
_ = require('lodash');
async = require('async');
debug = require('debug')('meshblu:SubscriptionGetter');
SimpleAuth = require('./simpleAuth');
SubscriptionGetter = (function() {
class SubscriptionGetter {
constructor(options, dependencies = {}) {
thi... | CoffeeScript | JavaScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 6934fed7ad8859101f0073d865cc2f820dcc608f | 815 | https://github.com/octoblu/meshblu/blob/6934fed7ad8859101f0073d865cc2f820dcc608f/lib/SubscriptionGetter.coffee | 1 | 50 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var SimpleAuth, SubscriptionGetter, _, async, debug;
_ = require('lodash');
async = require('async');
debug = require('debug')('meshblu:SubscriptionGetter');
SimpleAuth = require('./simpleAuth');
SubscriptionGetter = (function() {
class SubscriptionGetter {
... | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
@SECURITY_MAP:
broadcast: 'canReceive'
config: 'canDiscover'
constructor: (options, dependencies={}) ->
{@emitterUuid, @ty... | JavaScript | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 6934fed7ad8859101f0073d865cc2f820dcc608f | 815 | https://github.com/octoblu/meshblu/blob/6934fed7ad8859101f0073d865cc2f820dcc608f/lib/SubscriptionGetter.coffee | 1 | 50 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:completion | completion | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
@SECURITY_MAP:
broadcast: 'canReceive'
config: 'canDiscover'
constructor: (options, dependencies={}) ->
{@emitterUuid, @ty... | @subscriptions.find query, (error, subscriptions) =>
return callback error if error?
uuids = _.pluck subscriptions, 'subscriberUuid'
@_filterAuthorized emitterDevice, uuids, (error, devices) =>
return callback error if error?
callback null, _.pluck devices, 'uuid'
_getDev... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 6934fed7ad8859101f0073d865cc2f820dcc608f | 815 | https://github.com/octoblu/meshblu/blob/6934fed7ad8859101f0073d865cc2f820dcc608f/lib/SubscriptionGetter.coffee | 1 | 50 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:2:raw_corpus | raw_corpus | checkAuthorization = @simpleAuth[SubscriptionGetter.SECURITY_MAP[@type]]
return callback new Error "Unable to check type #{@type}" unless checkAuthorization?
checkAuthorization toDevice, emitterDevice, (error, authorized) =>
return callback error if error
return callback null, toDevice if a... | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 6934fed7ad8859101f0073d865cc2f820dcc608f | 815 | https://github.com/octoblu/meshblu/blob/6934fed7ad8859101f0073d865cc2f820dcc608f/lib/SubscriptionGetter.coffee | 51 | 60 | ||
octoblu/meshblu:lib/SubscriptionGetter.coffee:2:completion | completion | checkAuthorization = @simpleAuth[SubscriptionGetter.SECURITY_MAP[@type]]
return callback new Error "Unable to check type #{@type}" unless checkAuthorization?
checkAuthorization toDevice, emitterDevice, (error, authorized) => | return callback error if error
return callback null, toDevice if authorized
callback()
module.exports = SubscriptionGetter | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 6934fed7ad8859101f0073d865cc2f820dcc608f | 815 | https://github.com/octoblu/meshblu/blob/6934fed7ad8859101f0073d865cc2f820dcc608f/lib/SubscriptionGetter.coffee | 51 | 60 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
{@subscriptions, @getDevice, @simpleAuth} = dependenci... | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/lib/SubscriptionGetter.coffee | 1 | 46 | ||
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
... | var SimpleAuth, SubscriptionGetter, _, async, debug;
_ = require('lodash');
async = require('async');
debug = require('debug')('meshblu:SubscriptionGetter');
SimpleAuth = require('./simpleAuth');
SubscriptionGetter = class SubscriptionGetter {
constructor(options, dependencies = {}) {
this.get = this.get.bin... | CoffeeScript | JavaScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/lib/SubscriptionGetter.coffee | 1 | 46 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var SimpleAuth, SubscriptionGetter, _, async, debug;
_ = require('lodash');
async = require('async');
debug = require('debug')('meshblu:SubscriptionGetter');
SimpleAuth = require('./simpleAuth');
SubscriptionGetter = class SubscriptionGetter {
constructor(op... | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
{@subscriptions, @getDevice, @simpleAuth} = dependenci... | JavaScript | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/lib/SubscriptionGetter.coffee | 1 | 46 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:completion | completion | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
{@subscriptions, @getDevice, @simpleAuth} = dependenci... | @_getDevices uuids, (error, devices) =>
return callback error if error?
@_filterCanReceive emitterDevice, devices, (error, devices) =>
return callback error if error?
callback null, _.pluck devices, 'uuid'
_getDevices: (uuids, callback) =>
async.mapSeries uuids, (uuid... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 5f61924b7351403d201c82dc6606f07f97392f74 | 815 | https://github.com/octoblu/meshblu/blob/5f61924b7351403d201c82dc6606f07f97392f74/lib/SubscriptionGetter.coffee | 1 | 46 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
{@subscriptions, @getDevice, @simpleAuth} = dependenci... | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/lib/SubscriptionGetter.coffee | 1 | 50 | ||
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
... | var SimpleAuth, SubscriptionGetter, _, async, debug;
_ = require('lodash');
async = require('async');
debug = require('debug')('meshblu:SubscriptionGetter');
SimpleAuth = require('./simpleAuth');
SubscriptionGetter = class SubscriptionGetter {
constructor(options, dependencies = {}) {
this.get = this.get.bin... | CoffeeScript | JavaScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/lib/SubscriptionGetter.coffee | 1 | 50 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var SimpleAuth, SubscriptionGetter, _, async, debug;
_ = require('lodash');
async = require('async');
debug = require('debug')('meshblu:SubscriptionGetter');
SimpleAuth = require('./simpleAuth');
SubscriptionGetter = class SubscriptionGetter {
constructor(op... | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
{@subscriptions, @getDevice, @simpleAuth} = dependenci... | JavaScript | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/lib/SubscriptionGetter.coffee | 1 | 50 |
octoblu/meshblu:lib/SubscriptionGetter.coffee:1:completion | completion | _ = require 'lodash'
async = require 'async'
debug = require('debug')('meshblu:SubscriptionGetter')
SimpleAuth = require './simpleAuth'
class SubscriptionGetter
constructor: (options, dependencies={}) ->
{@emitterUuid, @type} = options
{@subscriptions, @getDevice, @simpleAuth} = dependenci... | @_getDevices uuids, (error, devices) =>
debug '@_getDevices', error, _.pluck(devices, 'uuid')
return callback error if error?
@_filterCanReceive emitterDevice, devices, (error, devices) =>
debug '@_filterCanReceive', error, _.pluck(devices, 'uuid')
return callback ... | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/SubscriptionGetter.coffee | MIT | 34fcd9be8665d56fe7253a9824cea239276ea0fe | 815 | https://github.com/octoblu/meshblu/blob/34fcd9be8665d56fe7253a9824cea239276ea0fe/lib/SubscriptionGetter.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:1:raw_corpus | raw_corpus | xdescribe 'Actions: message', ->
beforeEach ->
@action = require 'actions/message'
@api = require 'network/api'
describe 'Method: messageMore', ->
it 'should call api', ->
spyOn(@api.messages.read, 'get').and.callThrough()
data = query: 'query'
config = queryParams: data
@act... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 1 | 42 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
xdescribe 'Actions: message', ->
beforeEach ->
@action = require 'actions/message'
@api = require 'network/api'
describe 'Method: messageMore', ->
it 'should call api', ->
spyOn(@api.messages.read, 'get').and.callThrough()
data = qu... | xdescribe('Actions: message', function() {
beforeEach(function() {
this.action = require('actions/message');
return this.api = require('network/api');
});
describe('Method: messageMore', function() {
return it('should call api', function() {
var config, data;
spyOn(this.api.messages.read, ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 1 | 42 |
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
xdescribe('Actions: message', function() {
beforeEach(function() {
this.action = require('actions/message');
return this.api = require('network/api');
});
describe('Method: messageMore', function() {
return it('should call api', function() {
... | xdescribe 'Actions: message', ->
beforeEach ->
@action = require 'actions/message'
@api = require 'network/api'
describe 'Method: messageMore', ->
it 'should call api', ->
spyOn(@api.messages.read, 'get').and.callThrough()
data = query: 'query'
config = queryParams: data
@act... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 1 | 42 |
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:1:completion | completion | xdescribe 'Actions: message', ->
beforeEach ->
@action = require 'actions/message'
@api = require 'network/api'
describe 'Method: messageMore', ->
it 'should call api', ->
spyOn(@api.messages.read, 'get').and.callThrough()
data = query: 'query'
config = queryParams: data
@act... | config = queryParams: data
@action.requestMore(data)
expect(@api.messages.read.get).toHaveBeenCalledWith config
describe 'Method: messageCreate', ->
it 'should call api', ->
userStore = require 'store/user'
spyOn(userStore, 'get').and.returnValue 'creator'
spyOn(@api.messages.creat... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 1 | 42 |
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:2:raw_corpus | raw_corpus | messageId = 1
data = {}
config =
pathParams:
id: messageId
data: data
@action.messageUpdate(messageId, data)
expect(@api.messages.update.put).toHaveBeenCalledWith config
describe 'Method: messageDelete', ->
it 'should call api', ->
spyOn(@api.messages.remo... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 44 | 82 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:2:completion | completion | messageId = 1
data = {}
config =
pathParams:
id: messageId
data: data
@action.messageUpdate(messageId, data)
expect(@api.messages.update.put).toHaveBeenCalledWith config
describe 'Method: messageDelete', ->
it 'should call api', ->
spyOn(@api.messages.remo... | @action.messageDelete(message)
expect(@api.messages.remove.delete).toHaveBeenCalledWith config
describe 'Method: messageReadChat', ->
it 'should call api', ->
spyOn(@api.messages.read, 'get').and.callThrough()
teamId = 1
userId = 2
config =
queryParams:
_teamId: t... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 44 | 82 |
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:3:raw_corpus | raw_corpus | messageId = 1
config =
pathParams:
id: messageId
@action.starMessage(messageId)
expect(@api.messages.star.post).toHaveBeenCalledWith config
describe 'Method: unstarMessage', ->
it 'should call api', ->
spyOn(@api.messages.unstar, 'post').and.callThrough()
message... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 84 | 112 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/message.spec.coffee:3:completion | completion | messageId = 1
config =
pathParams:
id: messageId
@action.starMessage(messageId)
expect(@api.messages.star.post).toHaveBeenCalledWith config
describe 'Method: unstarMessage', ->
it 'should call api', ->
spyOn(@api.messages.unstar, 'post').and.callThrough()
message... | pathParams:
id: messageId
@action.unstarMessage(messageId)
expect(@api.messages.unstar.post).toHaveBeenCalledWith config
describe 'Method: uploadFile', ->
it 'should call api', ->
spyOn(@api.messages.create, 'post').and.callThrough()
data = {}
config = data: data
... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/message.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/message.spec.coffee | 84 | 112 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, opts = {}) ->
string = string.toString()
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.charmap[char]
code = string.charCodeAt(i)
... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e61c1fe4fc88c1661251f5a70c5448d3b9a8edab | 1,072 | https://github.com/dodo/node-slug/blob/e61c1fe4fc88c1661251f5a70c5448d3b9a8edab/src/slug.coffee | 75 | 99 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, opts = {}) ->
string = string.toString()
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.cha... | var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
string = string.toString();
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == null) {
opts.replacement = '-';
}
if (opts.charm... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | e61c1fe4fc88c1661251f5a70c5448d3b9a8edab | 1,072 | https://github.com/dodo/node-slug/blob/e61c1fe4fc88c1661251f5a70c5448d3b9a8edab/src/slug.coffee | 75 | 99 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
string = string.toString();
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == n... | module.exports = slug = (string, opts = {}) ->
string = string.toString()
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.charmap[char]
code = string.charCodeAt(i)
... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e61c1fe4fc88c1661251f5a70c5448d3b9a8edab | 1,072 | https://github.com/dodo/node-slug/blob/e61c1fe4fc88c1661251f5a70c5448d3b9a8edab/src/slug.coffee | 75 | 99 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, opts = {}) ->
string = string.toString()
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.charmap[char]
code = string.charCodeAt(i)
... | code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e61c1fe4fc88c1661251f5a70c5448d3b9a8edab | 1,072 | https://github.com/dodo/node-slug/blob/e61c1fe4fc88c1661251f5a70c5448d3b9a8edab/src/slug.coffee | 75 | 99 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.charmap[char]
code = string.charCodeAt(i)
else
char = opts.... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6 | 1,072 | https://github.com/dodo/node-slug/blob/d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6/src/slug.coffee | 75 | 98 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.charmap[char]
code = s... | var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == null) {
opts.replacement = '-';
}
if (opts.charmap == null) {
opts.charmap... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6 | 1,072 | https://github.com/dodo/node-slug/blob/d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6/src/slug.coffee | 75 | 98 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == null) {
opts.replacement = ... | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.charmap[char]
code = string.charCodeAt(i)
else
char = opts.... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6 | 1,072 | https://github.com/dodo/node-slug/blob/d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6/src/slug.coffee | 75 | 98 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
unless opts.charmap[char]
code = string.charCodeAt(i)
else
char = opts.... | unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
result += char
result = re... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6 | 1,072 | https://github.com/dodo/node-slug/blob/d8ad18cdf42e3554b7b9e2523b768dc7b8efe9f6/src/slug.coffee | 75 | 98 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
code = string.charCodeAt(i)
if opts.charmap[char]
char = opts.charmap[char]
... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | ca4f3aea45072020936f90430165151ab6b01312 | 1,072 | https://github.com/dodo/node-slug/blob/ca4f3aea45072020936f90430165151ab6b01312/src/slug.coffee | 75 | 97 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
code = string.charCodeAt(i)
if opts.ch... | var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == null) {
opts.replacement = '-';
}
if (opts.charmap == null) {
opts.charmap... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | ca4f3aea45072020936f90430165151ab6b01312 | 1,072 | https://github.com/dodo/node-slug/blob/ca4f3aea45072020936f90430165151ab6b01312/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == null) {
opts.replacement = ... | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
code = string.charCodeAt(i)
if opts.charmap[char]
char = opts.charmap[char]
... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | ca4f3aea45072020936f90430165151ab6b01312 | 1,072 | https://github.com/dodo/node-slug/blob/ca4f3aea45072020936f90430165151ab6b01312/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
opts.charmap ?= char_map
result = ""
for char, i in string
code = string.charCodeAt(i)
if opts.charmap[char]
char = opts.charmap[char]
... | unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
result += char
result = re... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | ca4f3aea45072020936f90430165151ab6b01312 | 1,072 | https://github.com/dodo/node-slug/blob/ca4f3aea45072020936f90430165151ab6b01312/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 697b96ef59a2ba4aa64999af3a7b696a7dd166b7 | 1,072 | https://github.com/dodo/node-slug/blob/697b96ef59a2ba4aa64999af3a7b696a7dd166b7/src/slug.coffee | 75 | 94 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = ch... | var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == null) {
opts.replacement = '-';
}
result = "";
for (i = j = 0, len = string.... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | 697b96ef59a2ba4aa64999af3a7b696a7dd166b7 | 1,072 | https://github.com/dodo/node-slug/blob/697b96ef59a2ba4aa64999af3a7b696a7dd166b7/src/slug.coffee | 75 | 94 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
}
if (opts.replacement == null) {
opts.replacement = ... | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 697b96ef59a2ba4aa64999af3a7b696a7dd166b7 | 1,072 | https://github.com/dodo/node-slug/blob/697b96ef59a2ba4aa64999af3a7b696a7dd166b7/src/slug.coffee | 75 | 94 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
opts.replacement ?= '-'
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0) | unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
result += char
result = re... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 697b96ef59a2ba4aa64999af3a7b696a7dd166b7 | 1,072 | https://github.com/dodo/node-slug/blob/697b96ef59a2ba4aa64999af3a7b696a7dd166b7/src/slug.coffee | 75 | 94 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.lowerCase
for char, i in string
code = string... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | b210e3f80dec4af18f39aec0abf0933b7213c511 | 1,072 | https://github.com/dodo/node-slug/blob/b210e3f80dec4af18f39aec0abf0933b7213c511/src/slug.coffee | 75 | 97 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.... | var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
} else if ('boolean' === typeof opts) {
opts = {
lowerCase: opts
};
}
if (opts.replacement == nu... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | b210e3f80dec4af18f39aec0abf0933b7213c511 | 1,072 | https://github.com/dodo/node-slug/blob/b210e3f80dec4af18f39aec0abf0933b7213c511/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
} else if ('boolean' === typeof opts) {
opts = {
... | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.lowerCase
for char, i in string
code = string... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | b210e3f80dec4af18f39aec0abf0933b7213c511 | 1,072 | https://github.com/dodo/node-slug/blob/b210e3f80dec4af18f39aec0abf0933b7213c511/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.lowerCase
for char, i in string
code = string... | char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | b210e3f80dec4af18f39aec0abf0933b7213c511 | 1,072 | https://github.com/dodo/node-slug/blob/b210e3f80dec4af18f39aec0abf0933b7213c511/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.lowerCase
for char, i in string
code = string... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 64c3476b0a056a3deafbbbf5a819f234eafd11c7 | 1,072 | https://github.com/dodo/node-slug/blob/64c3476b0a056a3deafbbbf5a819f234eafd11c7/src/slug.coffee | 75 | 97 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.... | var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
} else if ('boolean' === typeof opts) {
opts = {
lowerCase: opts
};
}
if (opts.replacement == nu... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | 64c3476b0a056a3deafbbbf5a819f234eafd11c7 | 1,072 | https://github.com/dodo/node-slug/blob/64c3476b0a056a3deafbbbf5a819f234eafd11c7/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, opts = {}) {
var char, code, i, j, k, len, len1, result, unicode, word;
if ('string' === typeof opts) {
opts = {
replacement: opts
};
} else if ('boolean' === typeof opts) {
opts = {
... | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.lowerCase
for char, i in string
code = string... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 64c3476b0a056a3deafbbbf5a819f234eafd11c7 | 1,072 | https://github.com/dodo/node-slug/blob/64c3476b0a056a3deafbbbf5a819f234eafd11c7/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, opts = {}) ->
if 'string' is typeof opts
opts = replacement:opts
else if 'boolean' is typeof opts
opts = lowerCase:opts
opts.replacement ?= '-'
result = ""
string = string.toLowerCase() if opts.lowerCase
for char, i in string
code = string... | char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 64c3476b0a056a3deafbbbf5a819f234eafd11c7 | 1,072 | https://github.com/dodo/node-slug/blob/64c3476b0a056a3deafbbbf5a819f234eafd11c7/src/slug.coffee | 75 | 97 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, replacement = '-', forceLowercase = false) ->
if typeof replacement is 'boolean'
replacement = '-'
forceLowercase = replacement
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3 | 1,072 | https://github.com/dodo/node-slug/blob/e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3/src/slug.coffee | 75 | 96 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, replacement = '-', forceLowercase = false) ->
if typeof replacement is 'boolean'
replacement = '-'
forceLowercase = replacement
result = ""
for char, i in string
code = string.charCodeAt(i)
... | var slug;
module.exports = slug = function(string, replacement = '-', forceLowercase = false) {
var char, code, i, j, k, len, len1, result, unicode, word;
if (typeof replacement === 'boolean') {
replacement = '-';
forceLowercase = replacement;
}
result = "";
for (i = j = 0, len = string.length; j < l... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3 | 1,072 | https://github.com/dodo/node-slug/blob/e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3/src/slug.coffee | 75 | 96 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, replacement = '-', forceLowercase = false) {
var char, code, i, j, k, len, len1, result, unicode, word;
if (typeof replacement === 'boolean') {
replacement = '-';
forceLowercase = replacement;
}
re... | module.exports = slug = (string, replacement = '-', forceLowercase = false) ->
if typeof replacement is 'boolean'
replacement = '-'
forceLowercase = replacement
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3 | 1,072 | https://github.com/dodo/node-slug/blob/e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3/src/slug.coffee | 75 | 96 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, replacement = '-', forceLowercase = false) ->
if typeof replacement is 'boolean'
replacement = '-'
forceLowercase = replacement
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
... | if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
if forceLowercase
char = char.toLowerCase()
... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3 | 1,072 | https://github.com/dodo/node-slug/blob/e63a2c1846c4fef95075f60d4d4d0a0753f4d4f3/src/slug.coffee | 75 | 96 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowe... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 9f3f89b09738a3b3433c17310f0e40683659f077 | 1,072 | https://github.com/dodo/node-slug/blob/9f3f89b09738a3b3433c17310f0e40683659f077/src/slug.coffee | 75 | 91 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
... | var slug;
module.exports = slug = function(string, replacement = '-') {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
if (char_map[char]) {
char = char_map[char];
... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | 9f3f89b09738a3b3433c17310f0e40683659f077 | 1,072 | https://github.com/dodo/node-slug/blob/9f3f89b09738a3b3433c17310f0e40683659f077/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, replacement = '-') {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
... | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowe... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 9f3f89b09738a3b3433c17310f0e40683659f077 | 1,072 | https://github.com/dodo/node-slug/blob/9f3f89b09738a3b3433c17310f0e40683659f077/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code] | if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\!\-:@]/g, '') # allowed
result += char
result = result.replace(/^\s+|\s+$/g, '') # tri... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 9f3f89b09738a3b3433c17310f0e40683659f077 | 1,072 | https://github.com/dodo/node-slug/blob/9f3f89b09738a3b3433c17310f0e40683659f077/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowe... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e70095728b1156f2de24fdecf61307876f274c38 | 1,072 | https://github.com/dodo/node-slug/blob/e70095728b1156f2de24fdecf61307876f274c38/src/slug.coffee | 75 | 91 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
... | var slug;
module.exports = slug = function(string, replacement = '-') {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
if (char_map[char]) {
char = char_map[char];
... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | e70095728b1156f2de24fdecf61307876f274c38 | 1,072 | https://github.com/dodo/node-slug/blob/e70095728b1156f2de24fdecf61307876f274c38/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, replacement = '-') {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
... | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowe... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e70095728b1156f2de24fdecf61307876f274c38 | 1,072 | https://github.com/dodo/node-slug/blob/e70095728b1156f2de24fdecf61307876f274c38/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code] | if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
result += char
result = result.replace(/^\s+|\s+$/g, '') #... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | e70095728b1156f2de24fdecf61307876f274c38 | 1,072 | https://github.com/dodo/node-slug/blob/e70095728b1156f2de24fdecf61307876f274c38/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowe... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 0a8adfce7ad2e46b6ba793903731bc057c07e091 | 1,072 | https://github.com/dodo/node-slug/blob/0a8adfce7ad2e46b6ba793903731bc057c07e091/src/slug.coffee | 75 | 91 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
... | var slug;
module.exports = slug = function(string, replacement = '-') {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
if (char_map[char]) {
char = char_map[char];
... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | 0a8adfce7ad2e46b6ba793903731bc057c07e091 | 1,072 | https://github.com/dodo/node-slug/blob/0a8adfce7ad2e46b6ba793903731bc057c07e091/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string, replacement = '-') {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
... | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowe... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 0a8adfce7ad2e46b6ba793903731bc057c07e091 | 1,072 | https://github.com/dodo/node-slug/blob/0a8adfce7ad2e46b6ba793903731bc057c07e091/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string, replacement = '-') ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code] | if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
result += char
result = result.replace(/^\s+|\s+$/g, '') #... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | 0a8adfce7ad2e46b6ba793903731bc057c07e091 | 1,072 | https://github.com/dodo/node-slug/blob/0a8adfce7ad2e46b6ba793903731bc057c07e091/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:raw_corpus | raw_corpus | module.exports = slug = (string) ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
... | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89 | 1,072 | https://github.com/dodo/node-slug/blob/dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89/src/slug.coffee | 75 | 91 | ||
dodo/node-slug:src/slug.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = slug = (string) ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
... | var slug;
module.exports = slug = function(string) {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
if (char_map[char]) {
char = char_map[char];
code = char.cha... | CoffeeScript | JavaScript | dodo/node-slug | src/slug.coffee | MIT | dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89 | 1,072 | https://github.com/dodo/node-slug/blob/dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var slug;
module.exports = slug = function(string) {
var char, code, i, j, k, len, len1, result, unicode, word;
result = "";
for (i = j = 0, len = string.length; j < len; i = ++j) {
char = string[i];
code = string.charCodeAt(i);
if (char_map[char... | module.exports = slug = (string) ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code]
if unicode
char = unicode.name.toLowerCase()
... | JavaScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89 | 1,072 | https://github.com/dodo/node-slug/blob/dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89/src/slug.coffee | 75 | 91 |
dodo/node-slug:src/slug.coffee:1:completion | completion | module.exports = slug = (string) ->
result = ""
for char, i in string
code = string.charCodeAt(i)
if char_map[char]
char = char_map[char]
code = char.charCodeAt(0)
unicode = symbols[code] | if unicode
char = unicode.name.toLowerCase()
char = char.replace(word, '') for word in removelist
char = char.replace(/^\s+|\s+$/g, '')
char = char.replace(/[^\w\s$\*\_\+~\.\(\)\'\"\!\-:@]/g, '') # allowed
result += char
result = result.replace(/^\s+|\s+$/g, '') #... | CoffeeScript | CoffeeScript | dodo/node-slug | src/slug.coffee | MIT | dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89 | 1,072 | https://github.com/dodo/node-slug/blob/dddd83a2b5d67715d9d0bdb67bba2d67bb2bcd89/src/slug.coffee | 75 | 91 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:raw_corpus | raw_corpus | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .sidebar').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is(':visible')
event.preventDefault()
toggleSidebar()
... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 1 | 40 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .sidebar').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is(':visib... | $(document).ready(function() {
var editors, initializeScrollspyFromHash, lastCompilationElapsedTime, textareas, toggleSidebar;
// Mobile navigation
toggleSidebar = function() {
return $('.navbar-toggler, .sidebar').toggleClass('show');
};
$('[data-toggle="offcanvas"]').click(toggleSidebar);
$('[data-act... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 1 | 40 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
$(document).ready(function() {
var editors, initializeScrollspyFromHash, lastCompilationElapsedTime, textareas, toggleSidebar;
// Mobile navigation
toggleSidebar = function() {
return $('.navbar-toggler, .sidebar').toggleClass('show');
};
$('[data-tog... | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .sidebar').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is(':visible')
event.preventDefault()
toggleSidebar()
... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 1 | 40 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:completion | completion | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .sidebar').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is(':visible')
event.preventDefault()
toggleSidebar()
... | initializeScrollspyFromHash = (hash) ->
$("#contents a.active[href!='#{hash}']").removeClass 'show'
$(window).on 'activate.bs.scrollspy', (event, target) -> # Why `window`? https://github.com/twbs/bootstrap/issues/20086
# We only want one active link in the nav
$("#contents a.active[href!='#{target.relat... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 1 | 40 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:raw_corpus | raw_corpus | initializeEditor = ($textarea) ->
index = $textarea.data 'index'
mode = if $textarea.hasClass('javascript-output') then 'javascript' else 'coffeescript'
editors[index] = editor = CodeMirror.fromTextArea $textarea[0],
mode: mode
theme: 'twilight'
indentUnit: 2
tabSize: 2
lineWra... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 42 | 80 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
initializeEditor = ($textarea) ->
index = $textarea.data 'index'
mode = if $textarea.hasClass('javascript-output') then 'javascript' else 'coffeescript'
editors[index] = editor = CodeMirror.fromTextArea $textarea[0],
mode: mode
theme: 'twi... | var initializeEditor;
initializeEditor = function($textarea) {
var editor, index, mode, pending;
index = $textarea.data('index');
mode = $textarea.hasClass('javascript-output') ? 'javascript' : 'coffeescript';
editors[index] = editor = CodeMirror.fromTextArea($textarea[0], {
mode: mode,
theme: 'twiligh... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 42 | 80 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var initializeEditor;
initializeEditor = function($textarea) {
var editor, index, mode, pending;
index = $textarea.data('index');
mode = $textarea.hasClass('javascript-output') ? 'javascript' : 'coffeescript';
editors[index] = editor = CodeMirror.fromTextA... | initializeEditor = ($textarea) ->
index = $textarea.data 'index'
mode = if $textarea.hasClass('javascript-output') then 'javascript' else 'coffeescript'
editors[index] = editor = CodeMirror.fromTextArea $textarea[0],
mode: mode
theme: 'twilight'
indentUnit: 2
tabSize: 2
lineWra... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 42 | 80 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:completion | completion | initializeEditor = ($textarea) ->
index = $textarea.data 'index'
mode = if $textarea.hasClass('javascript-output') then 'javascript' else 'coffeescript'
editors[index] = editor = CodeMirror.fromTextArea $textarea[0],
mode: mode
theme: 'twilight'
indentUnit: 2
tabSize: 2
lineWra... | clearTimeout pending
pending = setTimeout ->
lastCompilationStartTime = Date.now()
try
coffee = editor.getValue()
if index is 0 and $('#try').hasClass('show') # If this is the editor in Try CoffeeScript and it’s still visible
# Update the hash with the c... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 42 | 80 |
jashkenas/coffeescript:documentation/v2/docs.coffee:3:raw_corpus | raw_corpus | # Fix the code editors’ handling of tab-indented code
editor.addKeyMap
'Tab': (cm) ->
if cm.somethingSelected()
cm.indentSelection 'add'
else if /^\t/m.test cm.getValue()
# If any lines start with a tab, treat this as tab-indented code
cm.execCommand... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 82 | 120 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:3:completion | completion | # Fix the code editors’ handling of tab-indented code
editor.addKeyMap
'Tab': (cm) ->
if cm.somethingSelected()
cm.indentSelection 'add'
else if /^\t/m.test cm.getValue()
# If any lines start with a tab, treat this as tab-indented code
cm.execCommand... | initializeEditor $textarea
# Initialize the sibling column too
$siblingColumn = $ $textarea.parent().siblings()[0]
$siblingColumn.children('.placeholder-code').remove()
initializeEditor $ $siblingColumn.children('textarea')[0]
initializeTryEditors = ->
initializeEditor $ '#try-coffeescript-coffee... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 82 | 120 |
jashkenas/coffeescript:documentation/v2/docs.coffee:4:raw_corpus | raw_corpus | clearHash = ->
window.history.pushState '', document.title, window.location.pathname
$(window).on 'hashchange', ->
# Get rid of dangling # in the address bar
clearHash() if window.location.hash is ''
# Try CoffeeScript
toggleTry = (checkLocalStorage = no) ->
initializeTryEditors() if $('#try .Co... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 122 | 162 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
clearHash = ->
window.history.pushState '', document.title, window.location.pathname
$(window).on 'hashchange', ->
# Get rid of dangling # in the address bar
clearHash() if window.location.hash is ''
# Try CoffeeScript
toggleTry = (checkLocalS... | var clearHash, closeTry, toggleTry;
clearHash = function() {
return window.history.pushState('', document.title, window.location.pathname);
};
$(window).on('hashchange', function() {
if (window.location.hash === '') {
// Get rid of dangling # in the address bar
return clearHash();
}
});
// Try CoffeeSc... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 122 | 162 |
jashkenas/coffeescript:documentation/v2/docs.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var clearHash, closeTry, toggleTry;
clearHash = function() {
return window.history.pushState('', document.title, window.location.pathname);
};
$(window).on('hashchange', function() {
if (window.location.hash === '') {
// Get rid of dangling # in the addre... | clearHash = ->
window.history.pushState '', document.title, window.location.pathname
$(window).on 'hashchange', ->
# Get rid of dangling # in the address bar
clearHash() if window.location.hash is ''
# Try CoffeeScript
toggleTry = (checkLocalStorage = no) ->
initializeTryEditors() if $('#try .Co... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 122 | 162 |
jashkenas/coffeescript:documentation/v2/docs.coffee:4:completion | completion | clearHash = ->
window.history.pushState '', document.title, window.location.pathname
$(window).on 'hashchange', ->
# Get rid of dangling # in the address bar
clearHash() if window.location.hash is ''
# Try CoffeeScript
toggleTry = (checkLocalStorage = no) ->
initializeTryEditors() if $('#try .Co... | window.history.pushState '', document.title, window.location.pathname
$('[data-toggle="try"]').click toggleTry
$('[data-close="try"]').click closeTry
# Configure the initial state
if window.location.hash?
if window.location.hash is '#try'
toggleTry yes
else if window.location.hash.indexOf('#try... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 63d3b699d7f28ba10e097e9dc3e8b57aca84b77a | 16,577 | https://github.com/jashkenas/coffeescript/blob/63d3b699d7f28ba10e097e9dc3e8b57aca84b77a/documentation/v2/docs.coffee | 122 | 162 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:raw_corpus | raw_corpus | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .row-offcanvas').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is(':visible')
event.preventDefault()
toggleSideb... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 1 | 49 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .row-offcanvas').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is('... | $(document).ready(function() {
var editors, initializeScrollspyFromHash, lastCompilationElapsedTime, toggleSidebar;
// Mobile navigation
toggleSidebar = function() {
return $('.navbar-toggler, .row-offcanvas').toggleClass('show');
};
$('[data-toggle="offcanvas"]').click(toggleSidebar);
$('[data-action="... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 1 | 49 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
$(document).ready(function() {
var editors, initializeScrollspyFromHash, lastCompilationElapsedTime, toggleSidebar;
// Mobile navigation
toggleSidebar = function() {
return $('.navbar-toggler, .row-offcanvas').toggleClass('show');
};
$('[data-toggle="... | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .row-offcanvas').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is(':visible')
event.preventDefault()
toggleSideb... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 1 | 49 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:completion | completion | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.navbar-toggler, .row-offcanvas').toggleClass 'show'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.navbar-toggler').is(':visible')
event.preventDefault()
toggleSideb... | $(window).on 'activate.bs.scrollspy', (event, target) -> # Why `window`? https://github.com/twbs/bootstrap/issues/20086
# We only want one active link in the nav
$("#contents a.active[href!='#{target.relatedTarget}']").removeClass 'show'
$target = $("#contents a[href='#{target.relatedTarget}']")
# Updat... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 1 | 49 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:raw_corpus | raw_corpus | # Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
# If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
if mode is 'coffeescript'
pending = null
editor.on 'change', (instance, change) ->
clearTimeout pending... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 51 | 91 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
# If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
if mode is 'coffeescript'
pending = null
editor.on 'ch... | // Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
// If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
var pending;
if (mode === 'coffeescript') {
pending = null;
editor.on('change', function(instance, change) {
clearTimeou... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 51 | 91 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
// If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
var pending;
if (mode === 'coffeescript') {
pending = null;
editor.on... | # Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
# If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
if mode is 'coffeescript'
pending = null
editor.on 'change', (instance, change) ->
clearTimeout pending... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 51 | 91 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:completion | completion | # Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
# If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
if mode is 'coffeescript'
pending = null
editor.on 'change', (instance, change) ->
clearTimeout pending... | lastCompilationElapsedTime = Math.max(200, Date.now() - lastCompilationStartTime)
catch exception
output = "#{exception}"
editors[index + 1].setValue output
, lastCompilationElapsedTime
# Fix the code editors’ handling of tab-indented code
editor.addKeyMap
'T... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 51 | 91 |
jashkenas/coffeescript:documentation/v2/docs.coffee:3:raw_corpus | raw_corpus | # Handle the code example buttons
$('[data-action="run-code-example"]').click ->
run = $(@).data 'run'
index = $("##{$(@).data('example')}-js").data 'index'
js = editors[index].getValue()
js = "#{js}\nalert(#{unescape run});" unless run is yes
eval js
# Try CoffeeScript
toggleTry = (checkLoc... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 93 | 129 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Handle the code example buttons
$('[data-action="run-code-example"]').click ->
run = $(@).data 'run'
index = $("##{$(@).data('example')}-js").data 'index'
js = editors[index].getValue()
js = "#{js}\nalert(#{unescape run});" unless run is yes
... | // Handle the code example buttons
var closeTry, toggleTry;
$('[data-action="run-code-example"]').click(function() {
var index, js, run;
run = $(this).data('run');
index = $(`#${$(this).data('example')}-js`).data('index');
js = editors[index].getValue();
if (run !== true) {
js = `${js}\nalert(${unescape(... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 93 | 129 |
jashkenas/coffeescript:documentation/v2/docs.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Handle the code example buttons
var closeTry, toggleTry;
$('[data-action="run-code-example"]').click(function() {
var index, js, run;
run = $(this).data('run');
index = $(`#${$(this).data('example')}-js`).data('index');
js = editors[index].getValue();
... | # Handle the code example buttons
$('[data-action="run-code-example"]').click ->
run = $(@).data 'run'
index = $("##{$(@).data('example')}-js").data 'index'
js = editors[index].getValue()
js = "#{js}\nalert(#{unescape run});" unless run is yes
eval js
# Try CoffeeScript
toggleTry = (checkLoc... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 93 | 129 |
jashkenas/coffeescript:documentation/v2/docs.coffee:3:completion | completion | # Handle the code example buttons
$('[data-action="run-code-example"]').click ->
run = $(@).data 'run'
index = $("##{$(@).data('example')}-js").data 'index'
js = editors[index].getValue()
js = "#{js}\nalert(#{unescape run});" unless run is yes
eval js
# Try CoffeeScript
toggleTry = (checkLoc... | closeTry = ->
$('#try, #try-link').removeClass 'show'
$('[data-toggle="try"]').click toggleTry
$('[data-close="try"]').click closeTry
# Configure the initial state
if window.location.hash?
if window.location.hash is '#try'
toggleTry yes
else if window.location.hash.indexOf('#try') is 0
... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | df9d4a23432c05a004fa7d06a62917e7daa765f9 | 16,577 | https://github.com/jashkenas/coffeescript/blob/df9d4a23432c05a004fa7d06a62917e7daa765f9/documentation/v2/docs.coffee | 93 | 129 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:raw_corpus | raw_corpus | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.menu-button, .row-offcanvas').toggleClass 'active'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.menu-button').is(':visible')
event.preventDefault()
toggleSidebar()... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 44a27c62044b51b072944835bc40080c9a4a62aa | 16,577 | https://github.com/jashkenas/coffeescript/blob/44a27c62044b51b072944835bc40080c9a4a62aa/documentation/v2/docs.coffee | 1 | 49 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.menu-button, .row-offcanvas').toggleClass 'active'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.menu-button').is(':vis... | $(document).ready(function() {
var editors, initializeScrollspyFromHash, lastCompilationElapsedTime, toggleSidebar;
// Mobile navigation
toggleSidebar = function() {
return $('.menu-button, .row-offcanvas').toggleClass('active');
};
$('[data-toggle="offcanvas"]').click(toggleSidebar);
$('[data-action="s... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 44a27c62044b51b072944835bc40080c9a4a62aa | 16,577 | https://github.com/jashkenas/coffeescript/blob/44a27c62044b51b072944835bc40080c9a4a62aa/documentation/v2/docs.coffee | 1 | 49 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
$(document).ready(function() {
var editors, initializeScrollspyFromHash, lastCompilationElapsedTime, toggleSidebar;
// Mobile navigation
toggleSidebar = function() {
return $('.menu-button, .row-offcanvas').toggleClass('active');
};
$('[data-toggle="o... | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.menu-button, .row-offcanvas').toggleClass 'active'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.menu-button').is(':visible')
event.preventDefault()
toggleSidebar()... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 44a27c62044b51b072944835bc40080c9a4a62aa | 16,577 | https://github.com/jashkenas/coffeescript/blob/44a27c62044b51b072944835bc40080c9a4a62aa/documentation/v2/docs.coffee | 1 | 49 |
jashkenas/coffeescript:documentation/v2/docs.coffee:1:completion | completion | $(document).ready ->
# Mobile navigation
toggleSidebar = ->
$('.menu-button, .row-offcanvas').toggleClass 'active'
$('[data-toggle="offcanvas"]').click toggleSidebar
$('[data-action="sidebar-nav"]').click (event) ->
if $('.menu-button').is(':visible')
event.preventDefault()
toggleSidebar()... | $(window).on 'activate.bs.scrollspy', (event, target) -> # Why `window`? https://github.com/twbs/bootstrap/issues/20086
# We only want one active link in the nav
$(".nav-link.active[href!='#{target.relatedTarget}']").removeClass 'active'
$target = $(".nav-link[href='#{target.relatedTarget}']")
# Update ... | CoffeeScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 44a27c62044b51b072944835bc40080c9a4a62aa | 16,577 | https://github.com/jashkenas/coffeescript/blob/44a27c62044b51b072944835bc40080c9a4a62aa/documentation/v2/docs.coffee | 1 | 49 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:raw_corpus | raw_corpus | # Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
# If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
if mode is 'coffeescript'
pending = null
editor.on 'change', (instance, change) ->
clearTimeout pending... | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 44a27c62044b51b072944835bc40080c9a4a62aa | 16,577 | https://github.com/jashkenas/coffeescript/blob/44a27c62044b51b072944835bc40080c9a4a62aa/documentation/v2/docs.coffee | 51 | 91 | ||
jashkenas/coffeescript:documentation/v2/docs.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
# If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
if mode is 'coffeescript'
pending = null
editor.on 'ch... | // Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
// If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
var pending;
if (mode === 'coffeescript') {
pending = null;
editor.on('change', function(instance, change) {
clearTimeou... | CoffeeScript | JavaScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 44a27c62044b51b072944835bc40080c9a4a62aa | 16,577 | https://github.com/jashkenas/coffeescript/blob/44a27c62044b51b072944835bc40080c9a4a62aa/documentation/v2/docs.coffee | 51 | 91 |
jashkenas/coffeescript:documentation/v2/docs.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
// If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
var pending;
if (mode === 'coffeescript') {
pending = null;
editor.on... | # Whenever the user edits the CoffeeScript side of a code example, update the JavaScript output
# If the editor is Try CoffeeScript, also update the hash and save this code in localStorage
if mode is 'coffeescript'
pending = null
editor.on 'change', (instance, change) ->
clearTimeout pending... | JavaScript | CoffeeScript | jashkenas/coffeescript | documentation/v2/docs.coffee | MIT | 44a27c62044b51b072944835bc40080c9a4a62aa | 16,577 | https://github.com/jashkenas/coffeescript/blob/44a27c62044b51b072944835bc40080c9a4a62aa/documentation/v2/docs.coffee | 51 | 91 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.