
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@dollarshaveclub/js-utils
Advanced tools
DSC JS Utils JS utilities to be used across JS repositories.
Folders Usage Analytics Publishing Browser Docs Isomorphic Docs
⚠️⚠️ NOTE: this package is published publicly, so do not put any sensitive information in this repository. ⚠️⚠️
There are 2 key folders which contain utility scripts—browser and isomorphic. Browser utility scripts are meant to be used within a browser. Isomorphic utility scripts are scripts that can be run within any environment.
Browser-specific utilities scripts.
Utility scripts that work in any JavaScript environment. Read more.
Installing NPM:
npm i --save @dollarshaveclub/js-utils
Import the built versions of files from the build folder:
const {
SHOP_CODES,
ENVIRONMENTS,
} = require('@dollarshaveclub/js-utils/build/isomorphic/config')
You may be able to use the non-built versions in server environments, but always use the built versions in browser environments.
If interfacing with Tracksuit, initialize analytics in the following way.
Initialize once:
// src/bootstrap.js
import bootstrap from '@dollarshaveclub/js-utils/build/browser/bootstrap-data'
import { initializeAnalytics } from '@dollarshaveclub/js-utils/build/browser/analytics'
const faceAssetsFixtures = window.FaceAssetsFixtures
const { study, features } = bootstrap(faceAssetsFixtures)
// Be sure to provide Fixtures, AB Tests, and your specified vendors. Also be
// sure to export this constant if you wish to interface with your analytics
export const analytics = initializeAnalytics(
faceAssetsFixtures,
study.assignments(),
{
DTM: true,
GTM: true,
}
)
Access the export in other files
// app/home/index.js
import { analytics } from '../../bootstrap'
analytics.call('page') // Track page information
analytics.call('trackEvent', {
event: 'butt',
category: 'Link Click',
action: 'movies',
label: 'The Room',
value: '',
})
The analytics
API uses Tracksuit under the hood. You may pass any Tracksuit
function name to the analytics.call
function to execute it. All parameters are
retained.
Automatically updated and published when a release is cut. Also after a successful deploy, please be sure to update the version number and update face-web as well.
FAQs
DSC JS Utils JS utilities to be used across JS repositories.
The npm package @dollarshaveclub/js-utils receives a total of 292 weekly downloads. As such, @dollarshaveclub/js-utils popularity was classified as not popular.
We found that @dollarshaveclub/js-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.