Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

add file.codeData to extract user code #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 17, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use os.EOL instead
  • Loading branch information
magic-akari committed Sep 16, 2019
commit 9adf07d04e0efc9c5da349e52b672b077ab9c251
3 changes: 2 additions & 1 deletion lib/file.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
var fs = require('fs');
var os = require('os');
var path = require('path');

var _ = require('underscore');
Expand Down Expand Up @@ -119,7 +120,7 @@ file.codeData = function(fullpath) {
const end = lines.findIndex(x => x.indexOf('@lc code=end') !== -1);

if (start !== -1 && end !== -1 && start + 1 <= end) {
return lines.slice(start + 1, end).join(this.isWindows() ? '\r\n' : '\n');
return lines.slice(start + 1, end).join(os.EOL);
}

return data;
Expand Down