From e3a03049da009f13014849086e3090374591309b Mon Sep 17 00:00:00 2001 From: Raz Goldin Date: Tue, 1 Oct 2019 20:46:55 -0400 Subject: [PATCH] adding a few comments --- js/src/boot.js | 7 +++++-- js/src/crypto.js | 47 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/js/src/boot.js b/js/src/boot.js index b5a4bbe..fbbf2b1 100644 --- a/js/src/boot.js +++ b/js/src/boot.js @@ -1,8 +1,11 @@ +/** +* Introduction message: including version number. +*/ var bootMessageLines = [ "System loading...
", - (new Date()).toString()+"
", + `${(new Date()).toString()}
`, " _______   ______ 
|__   __| |  ____|
   | |    | |__   
   | |    |  __|  
   | |    | |     
   |_|    |_|     
", - "Terminal Faker version "+version+"
", + `Terminal Faker version ${version}
`, "By Sherri Wheeler (SyntaxSeed.com)
", "Ready. Type 'help' to get started.

" ]; diff --git a/js/src/crypto.js b/js/src/crypto.js index 27c7d1b..df38aea 100644 --- a/js/src/crypto.js +++ b/js/src/crypto.js @@ -1,12 +1,51 @@ "use strict"; -function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } } +/** +* Determines whether first input is the same instanceof second input. +* +* @param {any} left: first-input +* @param {any} right: second-input +* @return {boolean} isInstance: whether first is an instance of second. +*/ +function _instanceof(left, right) { + if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { + return right[Symbol.hasInstance](left); + } else { + return left instanceof right; + } +} -function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +/** +* Throws an error if classCallCheck. +* +* @param {any} instance: the item being checked for classCallCheck +* @param {Class} Constructor: the Constructor variety +* @throws {error} Cannot call a class as a function if it is not a Constructor instance. +*/ +function _classCallCheck(instance, Constructor) { + if (!_instanceof(instance, Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +/** +* Defines a list of properties on a object target +* +* +*/ +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } // The following has been transpiled from the original ES6 - ES5. The code above was added by BabelJS.