How to use hash-it - 9 common examples

To help you get started, we’ve selected a few hash-it examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frontity / frontity / packages / core / src / config / webpack / modules.ts View on Github external
rules: [
      {
        // Support for js, jsx, ts and tsx files.
        test: /\.(j|t)sx?$/,
        use: {
          loader: "babel-loader",
          options: {
            // Don't use the babelrc file of the root.
            babelrc: false,
            // This is a feature of `babel-loader` for webpack (not Babel itself).
            // It enables caching results in ./node_modules/.cache/babel-loader/
            // directory for faster rebuilds.
            cacheDirectory: true,
            // A unique hash using @babel/core's version, the babel-loader's version,
            // and the contents of babel.
            cacheIdentifier: hash({
              babelCoreVersion: babelCore.version,
              babelLoaderVersion: babelLoader.version,
              babel: babel
            }),
            // Instead, use the babel options directly from our babel object.
            ...babel[target]
          }
        }
      },
      {
        test: /\.(png|jpe?g|gif|svg)$/,
        use: [
          {
            loader: "file-loader",
            options: {
              name: (file: string): string => {
github planttheidea / crio / src / Crio.js View on Github external
get hashCode() {
    return hashIt(this);
  }
github planttheidea / crio / src / CrioObject.js View on Github external
get hashCode() {
    return hashIt(this, true);
  }
github planttheidea / crio / src / utils / crio.js View on Github external
const getSameCrioIfUnchanged = (crio, potentialCrio) => {
  const hashCode = hashIt(potentialCrio);

  if (crio[CRIO_HASH_CODE] === hashCode) {
    return crio;
  }

  return new crio.constructor(potentialCrio, hashCode);
};
github planttheidea / crio / src / classes.js View on Github external
  constructor(object, hashCode = hashIt(object)) {
    if (isCrio(object)) {
      return object;
    }

    let length = 0;

    forEach(object, (value, key) => {
      this[key] = getCrioedValue(value);

      length++;
    });

    OBJECT.defineProperties(this, {
      length: {
        enumerable: false,
        value: length
github planttheidea / crio / es / Crio.js View on Github external
get: function get() {
      return hashIt(this);
    }
  }], [{
github planttheidea / crio / src / CrioArray.js View on Github external
get hashCode() {
    return hashIt(this, true);
  }
github CacheControl / json-rules-engine / src / fact.js View on Github external
static hashFromObject (obj) {
    return hash(obj)
  }
github anywhichway / nano-memoize / benchmark / index.js View on Github external
const lodash = require('lodash').memoize;
const ramda = require('ramda').memoize;
const memoizee = require('memoizee');
const fastMemoize = require('fast-memoize');
const addyOsmani = require('./addy-osmani');
const memoizerific = require('memoizerific');
const lruMemoize = require('lru-memoize').default;
const moize = require('moize').default;
const microMemoize = require('micro-memoize'); 
const iMemoized = require('iMemoized');
const nanomemoize = require('../src/nano-memoize.js');


const deepEquals = require('lodash').isEqual;
const fastDeepEqual = require('fast-equals').deepEqual;
const hashItEquals = require('hash-it').isEqual;

const showResults = (benchmarkResults) => {
  const table = new Table({
    head: ['Name', 'Ops / sec', 'Relative margin of error', 'Sample size']
  });

  benchmarkResults.forEach((result) => {
    const name = result.target.name;
    const opsPerSecond = result.target.hz.toLocaleString('en-US', {
      maximumFractionDigits: 0
    });
    const relativeMarginOferror = ${result.target.stats.rme.toFixed(2)}%`;
    const sampleSize = result.target.stats.sample.length;

    table.push([name, opsPerSecond, relativeMarginOferror, sampleSize]);
  });

hash-it

Hash any object based on its value

MIT
Latest version published 2 years ago

Package Health Score

60 / 100
Full package analysis

Popular hash-it functions