How to use array-unique - 9 common examples

To help you get started, we’ve selected a few array-unique 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 alienfast / gulp-pipeline / src / aggregate.js View on Github external
// generate watch task
    if (this.watchableRecipes().length < 1) {
      this.debug(`No watchable recipes for task: ${coloredTask}`)
      return
    }

    this.debug(`Registering task: ${coloredTask}`)

    // https://github.com/alienfast/gulp-pipeline/issues/29
    // aggregate all globs into an array for a single watch fn call
    let globs = []
    for (let recipe of this.watchableRecipes()) {
      globs = globs.concat(this.watchToGlobs(recipe))
    }

    globs = unique(globs)
    this.debugDump('globs', globs)

    let watchFn = () => {
      this.log(`${coloredTask} watching ${globs.join(', ')}`)
      let watcher = this.gulp.watch(globs, {}, (done) => {

        // set this global so that BasGulp#notifyError can make sure not to exit if we are watching
        this.gulp.watching = true
        this.debug(`setting gulp.watching: ${this.gulp.watching}`)
        let result = this.taskFn(done)
        return result
      })

      // watcher.on('error', (error) => {
      //   this.notifyError(`${coloredTask} ${error}`)
      // })
github alienfast / gulp-pipeline / dist / gulp-pipeline.es.js View on Github external
// generate watch task
    if (this.watchableRecipes().length < 1) {
      this.debug(`No watchable recipes for task: ${coloredTask}`)
      return
    }

    this.debug(`Registering task: ${coloredTask}`)

    // https://github.com/alienfast/gulp-pipeline/issues/29
    // aggregate all globs into an array for a single watch fn call
    let globs = []
    for (let recipe of this.watchableRecipes()) {
      globs = globs.concat(this.watchToGlobs(recipe))
    }

    globs = unique(globs)
    this.debugDump('globs', globs)

    let watchFn = () => {
      this.log(`${coloredTask} watching ${globs.join(', ')}`)
      let watcher = this.gulp.watch(globs, {}, (done) => {

        // set this global so that BasGulp#notifyError can make sure not to exit if we are watching
        this.gulp.watching = true
        this.debug(`setting gulp.watching: ${this.gulp.watching}`)
        let result = this.taskFn(done)
        return result
      })

      // watcher.on('error', (error) => {
      //   this.notifyError(`${coloredTask} ${error}`)
      // })
github queicherius / gw2api-client / src / endpoint.js View on Github external
many (ids) {
    this.debugMessage(`many(${this.url}) called (${ids.length} ids)`)

    if (!this.isBulk) {
      return Promise.reject(new Error('"many" is only available for bulk expanding endpoints'))
    }

    // Exit out early if we don't request any ids
    if (ids.length === 0) {
      return Promise.resolve([])
    }

    // Always only work on unique ids, since that's how the API works
    ids = unique.immutable(ids)

    // There is no cache time set, so always use the live data
    if (!this.cacheTime) {
      return this._many(ids)
    }

    // Get as much as possible out of the cache
    const hashes = ids.map(id => this._cacheHash(id))
    const handleCacheContent = (cached) => {
      cached = cached.filter(x => x)

      if (cached.length === ids.length) {
        this.debugMessage(`many(${this.url}) resolving fully from cache`)
        return cached
      }
github recurly / recurly-js / lib / recurly / pricing / checkout / calculations.js View on Github external
get taxCodes () {
    const taxableItems = this.taxableAdjustments.concat(this.taxableSubscriptions);
    return uniq(taxableItems.map(item => item.taxCode));
  }
github buildkite / frontend / app / components / pipeline / CreateBuildDialog.js View on Github external
id="new-build-commit-suggestions"
              values={unique(commitSuggestions)}
            />

             this.buildCommitTextField = tf}
            />

            

             this.buildBranchTextField = tf}
            />
github recurly / recurly-js / lib / recurly / pricing / checkout / index.js View on Github external
get subscriptionPlanCodes () {
    return uniq(this.validSubscriptions.map(s => s.items.plan.code));
  }
github buildkite / frontend / app / components / pipeline / CreateBuildDialog.js View on Github external
<input value="{window._csrf.token}" name="{window._csrf.param}" type="hidden">

          <div>
            <h1>New Build</h1>

             this.buildMessageTextField = tf}
            /&gt;

            

             this.buildCommitTextField = tf}
            /&gt;

            
</div>
github shamansir / ielm / src / server / match-component.js View on Github external
function component(alias, baseComponent, requirements, payload) {
    return {
        alias: alias,
        base: baseComponent,
        requirements: requirements
            ? unique([ baseComponent ].concat(requirements))
            : [ baseComponent ],
        payload: payload
    }
}
github jonschlinkert / utils / lib / array / unique.js View on Github external
module.exports = function unique_(arr) {
  if (!Array.isArray(arr)) {
    throw new TypeError('utils#array.unique() expects an array.');
  }
  return uniq.apply(uniq, arguments);
};

array-unique

Remove duplicate values from an array. Fastest ES5 implementation.

MIT
Latest version published 8 years ago

Package Health Score

71 / 100
Full package analysis