JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 45
  • Score
    100M100P100Q63092F
  • License MIT

Scrabble's SOWPODS dictionary

Package Exports

  • pf-sowpods

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pf-sowpods) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pf-sowpods

Scrabble's SOWPODS dictionary - The SOWPODS dictionary with related functionality.

Examples

// Require the module to use it.
var sowpods = require('pf-sowpods');
sowpods[42]; // 'ABAPICAL'
sowpods.length; // 267752

// Verify words
sowpods.verify('banana'); // true
sowpods.verify('foobar'); // false

// Define words / get related word forms
sowpods.define('set');
// {TODO}

// Suggest words
sowpods.suggest('puth');
// {TODO}

// Get random words
sowpods.random(); // 'PICANINNIES'
sowpods.random(2); // ['REFRESHENS', 'EPILOGUIZING']

// Get all 2-letter words
sowpods.filter(function(word) {
  return word.length === 2;
});

// Get all words with 'Q'
sowpods.filter(function(word) {
  return word.indexOf('Q') !== -1;
});

API

sowpods (Array)

An alphabetized array of the SOWPODS dictionary. All letters are capitalized.

sowpods.verify(word)

  • word (String) - A word to check (case-insensitive)
  • returns (Boolean) - true if the word is in SOWPODS

This function performs a binary search to test if the word exists in the array. Note: Math.log(sowpods.length, 2) == 12.497816457936626

sowpods.random(count)

  • count (Number) - Optional. The number of random words to return
  • returns (String, Array) - Some random words

If count is undefined, it returns a single string. Otherwise it returns an array of length count of random strings.