Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@streetcredlabs/categories

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@streetcredlabs/categories

JS utility wrapper for places category taxonomy

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

Categories Build Status

This is a JavaScript utility module that represents a category taxonomy (nested list) for places people care about in the world, aka Points of Interest (POIs). Categories represent the place type, for example a Starbucks is a coffee_shop.

Usage

To Install Package through Github Directly

Include this snippet of code under the dependencies section within package.json file:

"categories": "git+ssh://github.com/streetcredlabs/categories.git"

Note: This is used for local module testing, because we haven't published the package through yarn nor npm yet. The user can npm install to download the package as if it was a npm/yarn package.

Import/require in the JavaScript client code

// using CommonJS
const { findById } = require('categories');

// using ES6
import { findById } from 'categories';

API

findById

const category = findById(1);

This function allows the client to lookup the category object by its id. Category objects will have the following structure. Categories may be nested.

{
  "id": 1,
  "name": "Arts & Entertainment",
  "icon": "theatre",
  "categories": [ <category> ]
}

Contributing to this project

Pull requests are warmly welcomed.

Clone the repo

git clone git@github.com:streetcredlabs/categories.git && cd categories

Install dependencies

yarn
or
npm i

Run tests and watch for changes:

yarn test-watch
or
npm run test-watch
Run tests once:
yarn test
or
npm run test

Run build and watch for changes:

yarn start
or
npm run start
Run build once:
yarn build
or
npm run build

Plugins/Modules Used Within Package

  • Rollup-plugin-json, which allows Rollup to import data from a JSON file.
  • Rollup-plugin-node-resolve, which allows us to load third-party modules in node_modules.
  • Rollup-plugin-commonjs, which coverts CommonJS modules to ES6, which stops them from breaking Rollup.
  • Babel, which transpiles new features of JavaScript (ES6/ES2015 and so on) into ES5

Why Are We Using Rollup.js?

  • Represents the next generation of build tools in terms of its performance (build time), intermediate configuration (less complicated than webpack but more involved than Parcel), and optional but out-of-the-box features likes source maps, and not using a .babelrc.
  • Rich ecosystem of plugins for file loading/dev servers
  • Code splitting
  • Tree shaking (live code inclusion / dead code elimination)
  • esnext:main entry in package.json to import es2015+ (renamed to ‘module’)
  • Scope hoisting
  • Simple API
  • Since codebase is ES2015 modules and we're making something to be used by other people

Reference: Rollup v. Webpack v. Parcel by Adam Gerard

FAQs

Package last updated on 07 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc