How to use @sindresorhus/string-hash - 4 common examples

To help you get started, we’ve selected a few @sindresorhus/string-hash 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 zooniverse / front-end-monorepo / packages / app-project / stores / UI.spec.js View on Github external
it('should have a `dismissAnnouncementBanner` action', function () {
      const expectedValue = stringHash(PROJECT.configuration.announcement)
      expect(store.dismissedAnnouncementBanner).to.equal(undefined)
      store.dismissAnnouncementBanner()
      expect(store.dismissedAnnouncementBanner).to.equal(expectedValue)
    })
github zooniverse / front-end-monorepo / packages / app-project / stores / UI.spec.js View on Github external
import stringHash from '@sindresorhus/string-hash'

import initStore from './initStore'

import UI from './UI'

const PROJECT = {
  configuration: {
    announcement: 'Nunc interdum justo fusce mi'
  },
  id: '2',
  display_name: 'Hello',
  slug: 'test/project'
}

const ANNOUNCEMENT_HASH = stringHash(PROJECT.configuration.announcement)

describe('Stores > UI', function () {
  it('should export an object', function () {
    expect(UI).to.be.an('object')
  })

  describe('mode', function () {
    let store

    beforeEach(function () {
      store = UI.create()
    })

    it('should contain a mode property', function () {
      expect(store.mode).to.be.ok()
    })
github zooniverse / front-end-monorepo / packages / app-project / stores / UI.js View on Github external
dismissAnnouncementBanner() {
      const { announcement } = getRoot(self).project.configuration
      const announcementHash = stringHash(announcement)
      self.dismissedAnnouncementBanner = announcementHash
    },
github zooniverse / front-end-monorepo / packages / app-project / stores / UI.js View on Github external
get showAnnouncement () {
      const { announcement } = getRoot(self).project.configuration
      return announcement
        ? stringHash(announcement) !== self.dismissedAnnouncementBanner
        : true
    }
  }))

@sindresorhus/string-hash

Get the hash of a string

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular @sindresorhus/string-hash functions