1.3.12 • Published 2 years ago

us-colleges v1.3.12

Weekly downloads
36
License
ISC
Repository
github
Last release
2 years ago

U.S. Colleges

This package exports 2 lists:

  • ALL_US_COLLEGES exports 2289 U.S. colleges.

  • POPULAR_US_COLLEGES exports top 100 U.S. colleges based on this list.

Usage

import { ALL_US_COLLEGES, POPULAR_US_COLLEGES } from '@ztopia/us-colleges';

console.log(ALL_US_COLLEGES);
// {
//   ...
//   'Stanford University': {
//     latitude: 37.431746,
//     longitude: -122.182212,
//     name: 'Stanford University',
//     translation: '斯坦福大学',
//     zip_code: '94305',
//     state_name: 'California',
//     state_abbreviation: 'CA',
//     city: 'Stanford',
//   },
//   ...
// }

Search

A lot of times, you probably don't want to return clients with all colleges, but only a subset based on queries. Filtering the entire list is slow, taking O(n) time, especially when you want to implement search-as-you-type feature. As a result, we recommend using Trie, a data structure designed for rapid reTRIEval of objects. It can get very complex to implement, but fortunately, there is an awesome library that does it for us: https://github.com/joshjung/trie-search

import TrieSearch from 'trie-search';

import { ALL_US_COLLEGES } from '@ztopia/us-colleges';

const ts = new TrieSearch();
ts.addFromObject(ALL_US_COLLEGES);
1.3.12

2 years ago

1.3.11

3 years ago

1.3.10

3 years ago

1.3.9

3 years ago

1.3.7

3 years ago

1.3.8

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.3

3 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago