Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
exotic-structures / wip / Hash.ts
Size: Mime:
/** @ignore 🚧 wip */

/**
 * @see https://github.com/qfox/Zeon/blob/master/Ast.js#L23
 * @see https://github.com/qfox/Zeon/blob/master/fuzzing/fuzzRuderManEdited.js#L1414
 */
var binaryOps = [
  /**
   * Long-standing JavaScript operators
   * roughly in order from  @see http://www.codehouse.com/javascript/precedence/
   */
  ' / ',
  ' % ',
  ' + ',
  ' - ',
  ' << ',
  ' >> ',
  ' >>> ',
  ' < ',
  ' > ',
  ' <= ',
  ' >= ',
  ' instanceof ',
  ' in ',
  ' == ',
  ' != ',
  ' === ',
  ' !== ',
  ' & ',
  ' | ',
  ' ^ ',
  ' && ',
  ' || ',
  ' = ',
  ' *= ',
  ' /= ',
  ' %= ',
  ' += ',
  ' -= ',
  ' <<= ',
  ' >>= ',
  ' >>>=',
  ' &= ',
  ' ^= ',
  ' |= ',
  ' , ',
  //  ,

  // . is special, so test it as a group of right-unary ops, a special exprMaker for property access, and a special exprMaker for the xml filtering predicate operator
  // " . ",

  // Added by E4X
  //  " :: ", " .. ", " @ ",
  // Frequent combinations of E4X things (and "*" namespace, which isn't produced by this fuzzer otherwise)
  //  " .@ ", " .@*:: ", " .@x:: ",
]

// http://heatfiler.qfox.nl/#run,code,here
// function _has(obj, path) {
//   if (!Array.isArray(path)) {
//     return obj != null && hasOwnProperty.call(obj, path)
//   }
//   var length = path.length
//   for (var i = 0; i < length; i++) {
//     var key = path[i]
//     if (obj == null || !hasOwnProperty.call(obj, key)) {
//       return false
//     }
//     obj = obj[key]
//   }
//   return !!length
// }
//
// _has({eh: true}, 'oh')
// _has({eh: true}, 'eh')
// _has({eh: true}, 'eh')
// _has({}, 'eh')
// _has({}, 'eh')
// _has({}, 'eh')

// * https://github.com/qfox/heatfiler/blob/master/lib/tok.js#L660
// * https://github.com/qfox/heatfiler/blob/master/lib/par.js#L1130
// https://github.com/the-grid/finitedomain/blob/master/src/trie.js#L481
// function bytes(b) {
//   if (b < 1024) return b + ' b'
//   b /= 1024
//   if (b < 1024) return ~~(b * 100) / 100 + ' kb'
//   b /= 1024
//   if (b < 1024) return ~~(b * 100) / 100 + ' mb'
//   b /= 1024
//   return ~~(b * 100) / 100 + ' gb'
// }

// // diff but same name
// //
// // https://github.com/processing-js/processing-js/blob/master/src/P5Functions/JavaProxyFunctions.js
// // https://github.com/processing-js/processing-js/blob/master/src/Objects/webcolors.js
// // https://github.com/processing-js/processing-js/blob/master/src/Helpers/virtHashCode.js
// // https://github.com/processing-js/processing-js/blob/master/src/Objects/HashMap.js
//
// /** Used to stand-in for `undefined` hash values. */
// const HASH_UNDEFINED = '__lodash_hash_undefined__'
//
// class Hash {
//   /**
//    * Creates a hash object.
//    *
//    * @private
//    * @constructor
//    * @param {Array} [entries] The key-value pairs to cache.
//    */
//   constructor(entries) {
//     let index = -1
//     const length = entries == null ? 0 : entries.length
//
//     this.clear()
//     while (++index < length) {
//       const entry = entries[index]
//       this.set(entry[0], entry[1])
//     }
//   }
//
//   /**
//    * Removes all key-value entries from the hash.
//    *
//    * @memberOf Hash
//    */
//   clear() {
//     this.__data__ = Object.create(null)
//     this.size = 0
//   }
//
//   /**
//    * Removes `key` and its value from the hash.
//    *
//    * @memberOf Hash
//    * @param {Object} hash The hash to modify.
//    * @param {string} key The key of the value to remove.
//    * @returns {boolean} Returns `true` if the entry was removed, else `false`.
//    */
//   delete(key) {
//     const result = this.has(key) && delete this.__data__[key]
//     this.size -= result ? 1 : 0
//     return result
//   }
//
//   /**
//    * Gets the hash value for `key`.
//    *
//    * @memberOf Hash
//    * @param {string} key The key of the value to get.
//    * @returns {*} Returns the entry value.
//    */
//   get(key) {
//     const data = this.__data__
//     const result = data[key]
//     return result === HASH_UNDEFINED ? undefined : result
//   }
//
//   /**
//    * Checks if a hash value for `key` exists.
//    *
//    * @memberOf Hash
//    * @param {string} key The key of the entry to check.
//    * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
//    */
//   has(key) {
//     const data = this.__data__
//     return data[key] !== undefined
//   }
//
//   /**
//    * Sets the hash `key` to `value`.
//    *
//    * @memberOf Hash
//    * @param {string} key The key of the value to set.
//    * @param {*} value The value to set.
//    * @returns {Object} Returns the hash instance.
//    */
//   set(key, value) {
//     const data = this.__data__
//     this.size += this.has(key) ? 0 : 1
//     data[key] = value === undefined ? HASH_UNDEFINED : value
//     return this
//   }
// }
//
// export default Hash