New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lutils

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lutils

A few reliable utils.

  • 1.2.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.8K
decreased by-7.13%
Maintainers
1
Weekly downloads
 
Created
Source

Lutils lutils

A few reliable utils. Browser-friendly.

import { typeOf, merge, clone } from 'lutils'
let { typeOf, merge, clone } = require('lutils')

typeOf = require('lutils-typeof')
merge  = require('lutils-merge')
clone  = require('lutils-clone')

API

merge

Recursively merge objects. See lutils-merge

clone

Recursively clone objects. See lutils-clone

typeOf

Type check for primitives reliably. See lutils-typeof

Why?

Javascript doesn't need a lot on top of it now that we have ES6/ES7. Some things are still too hard to do, which is exactly what these utils try to fix.

Example

Below, a config file, development.js, can be composed of multiple files.

import { merge, clone } from 'lutils'

export default merge(
    clone( require('./default') ),
    {
        database: "development",
        server: { port: 1337 }
    }
    clone( require('./local') )
)
/*
    {
        name: "My App",
        database: "development",
        server: {
            host: "0.0.0.0",
            port: 1337,
        },
        ssh: { privateKey: "~/.ssh/myLocalPrivateKey.pem" }
    }
*/

The above config would first inherit the default config, overwriting database and server.port. ./local, a git untracked file, would then overwrite aspects specific to the developers machine, such as the ssh.privateKey.

Because each config is cloned when required, the file ./default will not be mutated, even though it is the base.

Keywords

FAQs

Package last updated on 10 Jan 2017

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