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

customize

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

customize

A simple framework to create customizable engines

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1K
decreased by-4.51%
Maintainers
1
Weekly downloads
 
Created
Source

customize

A simple framework to create customizable engines

Customize is an abstraction of bootprint's the merging-behaviour. It allows you to create your own projects and engines (other than Less and Handlebars) and create overridable configurations for those.

At its core, it uses lodash#merge to merge configurations, but it uses a customizer-function that also supports promises and custom overrider functions attached to the object.

Currently, there is only one engine (customize-engine-handlebars) and one project that actually uses Customize (Thought). Bootprint will use Customize as well, once all features (i.e. like a file watcher) are implemented.

Installation

npm install customize

API-reference

Global


exports()

Create a new Customize object with an empty configuration

Returns: Customize

Class: Customize

The main class. The heart of Customize

withParent: , The main class. The heart of Customize leaf: , The main class. The heart of Customize overrider: customOverrider , The main class. The heart of Customize

Customize.registerEngine(id, engine)

Register an engine with a default config

Parameters

id: string, the identifier of the engine (also within the config)

engine: function, Register an engine with a default config

Customize.merge(config)

Creates a new instance of Customize. The config of the current Customize are used as default values and are overridden by the config provided as parameter.

Parameters

config: object, config overriding the config of this builder

Returns: Customize, new Builder instance

Customize.load(builderFunction)

Inherit configuration config from another module. require("Customize-modulename") usually return a function(builder) and this functions needs to be passed in here. A new Customize will be returned that overrides the current config with config from the builderFunction's result.

Parameters

builderFunction: function, that receives a Customize as paramater and returns a Customize with changed configuration.

Returns: Customize, the result of the builderFunction

Customize.build()

Build the configured Bootprint-instance.

Returns: Promise.<object>, a promise for the whole configuration

Customize.run()

Run each engine with its part of the config.

Customize.customOverrider(a, b, propertyName)

Customize has predefined override rules for merging configs.

  • If the overriding object has a _customize_custom_overrider function-property, it is called to perform the merger.
  • Arrays are concatenated
  • Promises are resolved and the results are merged

Parameters

a: , the overridden value

b: , the overriding value

propertyName: , the property name

Returns: *, the merged value


License

customize is published under the MIT-license. See LICENSE.md for details.

Contributing Guidelines

Contributions are always welcome!

Before spending lots of time on something, ask for feedback on your idea first!

Please search issues and pull requests before adding something new to avoid duplicating efforts and conversations.

Installing

Fork and clone the repo, then npm install to install all dependencies and npm test to ensure all is okay before you start anything.

Testing

Tests are run with npm test. Please ensure all tests are passing before submitting a pull request (unless you're creating a failing test to increase test coverage or show a problem).

Code Style

standard

This repository uses standard to maintain code style and consistency, and to avoid style arguments.

npm i standard -g

It is intentional to don't have standard, istanbul and coveralls in the devDependencies. Travis will handle all that stuffs. That approach will save bandwidth also installing and development time.

FAQs

Package last updated on 14 Jul 2015

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