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

angular-write-constants

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-write-constants - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

21

index.js

@@ -5,2 +5,6 @@ 'use strict';

function macroStyleKey(key) {
return key.replace(/[^A-Z][A-Z]/g, m => m[0] + '_' + m[1]).toUpperCase();
}
exports.constantList = function(files, moduleName) {

@@ -10,13 +14,18 @@ const j = {};

files.forEach(file => {
Object.assign(j, JSON.parse(fs.readFileSync(file)));
const origJSON = JSON.parse(fs.readFileSync(file));
const macroStyleKeysJSON = {};
Object.keys(origJSON).forEach(k => {
macroStyleKeysJSON[macroStyleKey(k)] = origJSON[k];
});
Object.assign(j, macroStyleKeysJSON);
});
let s = 'angular.module("' + moduleName + '")\n' +
Object.keys(j).map(key => {
const macroStyleKey = key.replace(/[^A-Z][A-Z]/g, m => m[0] + '_' + m[1]).toUpperCase();
return ' .constant("' + macroStyleKey + '", ' + JSON.stringify(j[key]) + ')';
}).join('\n') + ';\n';
Object.keys(j).map(key => (
' .constant("' + key + '", ' + JSON.stringify(j[key]) + ')'
)).join('\n') + ';\n';
return s;
};
{
"name": "angular-write-constants",
"version": "1.0.0",
"version": "1.0.1",
"description": "Create a JS config for angular using constants",

@@ -5,0 +5,0 @@ "main": "index.js",

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