mirror of
				https://github.com/JuanCanham/HackMyResume.git
				synced 2025-11-03 22:37:27 +00:00 
			
		
		
		
	feat: include private fields during convert
This commit is contained in:
		
							
								
								
									
										2
									
								
								dist/core/abstract-resume.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/core/abstract-resume.js
									
									
									
									
										vendored
									
									
								
							@@ -78,7 +78,7 @@ Definition of the AbstractResume class.
 | 
				
			|||||||
      traverse = require('traverse');
 | 
					      traverse = require('traverse');
 | 
				
			||||||
      ignoreList = [];
 | 
					      ignoreList = [];
 | 
				
			||||||
      privateList = [];
 | 
					      privateList = [];
 | 
				
			||||||
      includePrivates = (opts != null ? opts["private"] : void 0) == null ? true : opts != null ? opts["private"] : void 0;
 | 
					      includePrivates = opts && opts["private"];
 | 
				
			||||||
      scrubbed = traverse(rep).map(function() {
 | 
					      scrubbed = traverse(rep).map(function() {
 | 
				
			||||||
        if (!this.isLeaf) {
 | 
					        if (!this.isLeaf) {
 | 
				
			||||||
          if (this.node.ignore === true || this.node.ignore === 'true') {
 | 
					          if (this.node.ignore === true || this.node.ignore === 'true') {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								dist/core/fresh-resume.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								dist/core/fresh-resume.js
									
									
									
									
										vendored
									
									
								
							@@ -77,10 +77,11 @@ Definition of the FRESHResume class.
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    FreshResume.prototype.parseJSON = function(rep, opts) {
 | 
					    FreshResume.prototype.parseJSON = function(rep, opts) {
 | 
				
			||||||
      var ignoreList, privateList, ref, ref1, scrubbed, that;
 | 
					      var ignoreList, privateList, ref, ref1, scrubbed;
 | 
				
			||||||
      that = this;
 | 
					      if (opts && opts.privatize) {
 | 
				
			||||||
        ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
 | 
					        ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
 | 
				
			||||||
      extend(true, this, scrubbed);
 | 
					      }
 | 
				
			||||||
 | 
					      extend(true, this, opts && opts.privatize ? scrubbed : rep);
 | 
				
			||||||
      if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
 | 
					      if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
 | 
				
			||||||
        opts = opts || {};
 | 
					        opts = opts || {};
 | 
				
			||||||
        if (opts.imp === void 0 || opts.imp) {
 | 
					        if (opts.imp === void 0 || opts.imp) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								dist/core/jrs-resume.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								dist/core/jrs-resume.js
									
									
									
									
										vendored
									
									
								
							@@ -71,11 +71,12 @@ Definition of the JRSResume class.
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    JRSResume.prototype.parseJSON = function(rep, opts) {
 | 
					    JRSResume.prototype.parseJSON = function(rep, opts) {
 | 
				
			||||||
      var ignoreList, privateList, ref, ref1, scrubbed, that;
 | 
					      var ignoreList, privateList, ref, ref1, scrubbed;
 | 
				
			||||||
      opts = opts || {};
 | 
					      opts = opts || {};
 | 
				
			||||||
      that = this;
 | 
					      if (opts.privatize) {
 | 
				
			||||||
        ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
 | 
					        ref = this.scrubResume(rep, opts), scrubbed = ref.scrubbed, ignoreList = ref.ignoreList, privateList = ref.privateList;
 | 
				
			||||||
      extend(true, this, scrubbed);
 | 
					      }
 | 
				
			||||||
 | 
					      extend(true, this, opts.privatize ? scrubbed : rep);
 | 
				
			||||||
      if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
 | 
					      if (!((ref1 = this.imp) != null ? ref1.processed : void 0)) {
 | 
				
			||||||
        opts = opts || {};
 | 
					        opts = opts || {};
 | 
				
			||||||
        if (opts.imp === void 0 || opts.imp) {
 | 
					        if (opts.imp === void 0 || opts.imp) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								dist/verbs/convert.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								dist/verbs/convert.js
									
									
									
									
										vendored
									
									
								
							@@ -93,7 +93,10 @@ Implementation of the 'convert' verb for HackMyResume.
 | 
				
			|||||||
    var rez, rinfo, srcFmt, targetFormat;
 | 
					    var rez, rinfo, srcFmt, targetFormat;
 | 
				
			||||||
    rinfo = ResumeFactory.loadOne(src, {
 | 
					    rinfo = ResumeFactory.loadOne(src, {
 | 
				
			||||||
      format: null,
 | 
					      format: null,
 | 
				
			||||||
      objectify: true
 | 
					      objectify: true,
 | 
				
			||||||
 | 
					      inner: {
 | 
				
			||||||
 | 
					        privatize: false
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    if (rinfo.fluenterror) {
 | 
					    if (rinfo.fluenterror) {
 | 
				
			||||||
      this.stat(HMEVENT.beforeConvert, {
 | 
					      this.stat(HMEVENT.beforeConvert, {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@ class AbstractResume
 | 
				
			|||||||
    traverse = require 'traverse'
 | 
					    traverse = require 'traverse'
 | 
				
			||||||
    ignoreList = []
 | 
					    ignoreList = []
 | 
				
			||||||
    privateList = []
 | 
					    privateList = []
 | 
				
			||||||
    includePrivates = if not opts?.private? then true else opts?.private
 | 
					    includePrivates = opts && opts.private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    scrubbed = traverse( rep ).map () -> # [^1]
 | 
					    scrubbed = traverse( rep ).map () -> # [^1]
 | 
				
			||||||
      if !@isLeaf
 | 
					      if !@isLeaf
 | 
				
			||||||
@@ -86,7 +86,7 @@ class AbstractResume
 | 
				
			|||||||
module.exports = AbstractResume
 | 
					module.exports = AbstractResume
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# [^1]: As of this writing, the NPM traverse library has a quirk when attempting
 | 
					# [^1]: As of v0.6.6, the NPM traverse library has a quirk when attempting
 | 
				
			||||||
# to remove array elements directly using traverse's `this.remove`. See:
 | 
					# to remove array elements directly using traverse's `this.remove`. See:
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# https://github.com/substack/js-traverse/issues/48
 | 
					# https://github.com/substack/js-traverse/issues/48
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,12 +53,12 @@ class FreshResume extends AbstractResume
 | 
				
			|||||||
  ###
 | 
					  ###
 | 
				
			||||||
  parseJSON: ( rep, opts ) ->
 | 
					  parseJSON: ( rep, opts ) ->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if opts and opts.privatize
 | 
				
			||||||
      # Ignore any element with the 'ignore: true' or 'private: true' designator.
 | 
					      # Ignore any element with the 'ignore: true' or 'private: true' designator.
 | 
				
			||||||
    that = @
 | 
					 | 
				
			||||||
      { scrubbed, ignoreList, privateList } = @scrubResume rep, opts
 | 
					      { scrubbed, ignoreList, privateList } = @scrubResume rep, opts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Now apply the resume representation onto this object
 | 
					    # Now apply the resume representation onto this object
 | 
				
			||||||
    extend( true, @, scrubbed );
 | 
					    extend true, @, if opts and opts.privatize then scrubbed else rep
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # If the resume has already been processed, then we are being called from
 | 
					    # If the resume has already been processed, then we are being called from
 | 
				
			||||||
    # the .dupe method, and there's no need to do any post processing
 | 
					    # the .dupe method, and there's no need to do any post processing
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,12 +48,12 @@ class JRSResume extends AbstractResume
 | 
				
			|||||||
  ###
 | 
					  ###
 | 
				
			||||||
  parseJSON: ( rep, opts ) ->
 | 
					  parseJSON: ( rep, opts ) ->
 | 
				
			||||||
    opts = opts || { };
 | 
					    opts = opts || { };
 | 
				
			||||||
 | 
					    if opts.privatize
 | 
				
			||||||
      # Ignore any element with the 'ignore: true' or 'private: true' designator.
 | 
					      # Ignore any element with the 'ignore: true' or 'private: true' designator.
 | 
				
			||||||
    that = this
 | 
					 | 
				
			||||||
      { scrubbed, ignoreList, privateList } = @scrubResume rep, opts
 | 
					      { scrubbed, ignoreList, privateList } = @scrubResume rep, opts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Extend resume properties onto ourself.
 | 
					    # Extend resume properties onto ourself.
 | 
				
			||||||
    extend true, this, scrubbed
 | 
					    extend true, this, if opts.privatize then scrubbed else rep
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Set up metadata
 | 
					    # Set up metadata
 | 
				
			||||||
    if !@imp?.processed
 | 
					    if !@imp?.processed
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,7 +77,11 @@ _convert = ( srcs, dst, opts ) ->
 | 
				
			|||||||
_convertOne = (src, dst, idx) ->
 | 
					_convertOne = (src, dst, idx) ->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Load the resume
 | 
					  # Load the resume
 | 
				
			||||||
  rinfo = ResumeFactory.loadOne src, format: null, objectify: true
 | 
					  rinfo = ResumeFactory.loadOne src,
 | 
				
			||||||
 | 
					    format: null
 | 
				
			||||||
 | 
					    objectify: true,
 | 
				
			||||||
 | 
					    inner:
 | 
				
			||||||
 | 
					      privatize: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # If a load error occurs, report it and move on to the next file (if any)
 | 
					  # If a load error occurs, report it and move on to the next file (if any)
 | 
				
			||||||
  if rinfo.fluenterror
 | 
					  if rinfo.fluenterror
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user