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

i18n-iso-639-1

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18n-iso-639-1 - npm Package Compare versions

Comparing version 1.1.3 to 2.0.0

.babelrc

24

package.json
{
"name": "i18n-iso-639-1",
"version": "1.1.3",
"version": "2.0.0",
"description": "JavaScript utilities for ISO-639-1 codes",
"homepage": "https://github.com/sanishmaharjan/i18n-iso-639-1.git#readme",
"main": "./index.js",
"main": "./build/i18n-iso-639-1.js",
"scripts": {
"build": "webpack",
"test": "mocha"
"build": "webpack --env dev && webpack --env build && npm run test",
"dev": "webpack --progress --colors --watch --env dev",
"test": "mocha --require babel-core/register --colors ./test/*.spec.js"
},

@@ -30,14 +31,13 @@ "repository": {

"babel-core": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-loader": "^7.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2016": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"clean-webpack-plugin": "^0.1.17",
"babel-preset-env": "^1.6.1",
"chai": "^4.1.2",
"eslint": "^4.13.1",
"eslint-loader": "^1.9.0",
"mocha": "^4.0.1",
"webpack": "^3.10.0"
},
"dependencies": {
"babel-preset-env": "^1.6.1"
"webpack": "^3.10.0",
"yargs": "^10.0.3"
}
}

@@ -1,43 +0,50 @@

'use strict';
const isoCodes = require('./data');
const i18nIsoFunctions = {
getLanguages : function getLanguages(codes) {
return codes.map(code => ({
code,
name: this.getName(code),
nativeName: this.getNativeName(code),
}));
},
getAllNames : function getAllNames() {
return Object.values(isoCodes).map(l => l.name);
},
getName : function getName(code) {
return this.validate(code) ? isoCodes[code].name : '';
},
getNativeName : function getNativeName(code) {
return this.validate(code) ? isoCodes[code].nativeName : '';
},
getAllNativeNames : function getAllNativeNames() {
return Object.values(isoCodes).map(l => l.nativeName);
},
getAllCodes : function getAllCodes() {
return Object.keys(isoCodes);
},
getCode : function getCode(name) {
const code = Object.keys(isoCodes).find(code => {
const language = isoCodes[code];
return (
language.name.toLowerCase() === name.toLowerCase() ||
class IsoCodes {
getLanguages(codes) {
return codes.map(code => ({
code,
name: this.getName(code),
nativeName: this.getNativeName(code)
}));
}
getAllNames() {
return Object.values(isoCodes).map(l => l.name);
}
getName(code) {
return this.validate(code) ? isoCodes[code].name : '';
}
getAllNativeNames() {
return Object.values(isoCodes).map(l => l.nativeName);
}
getNativeName(code) {
return this.validate(code) ? isoCodes[code].nativeName : '';
}
getAllCodes() {
return Object.keys(isoCodes);
}
getCode(name) {
const code = Object.keys(isoCodes).find(code => {
const language = isoCodes[code];
return (
language.name.toLowerCase() === name.toLowerCase() ||
language.nativeName.toLowerCase() === name.toLowerCase()
);
});
return code || '';
},
validate : function validate(code) {
return isoCodes[code] !== undefined;
}
};
);
});
exports.i18nIsoFunctions = i18nIsoFunctions;
return code || '';
}
validate(code) {
return isoCodes[code] !== undefined;
}
}
export default new IsoCodes();

@@ -0,34 +1,49 @@

const webpack = require('webpack');
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const env = require('yargs').argv.env;
const pkg = require('./package.json');
let webpackConfig = {
entry: {
index: './src/index.js',
},
output: {
path: path.resolve(__dirname, `./build`),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2016', 'env', 'stage-2'],
plugins: ['add-module-exports', 'transform-runtime'],
},
},
},
],
},
plugins: [
new webpack.NamedModulesPlugin(),
new CleanWebpackPlugin(['./build']),
],
let libraryName = pkg.name;
let plugins = [], outputFile;
if (env === 'build') {
plugins.push(new UglifyJsPlugin({minimize: true}));
outputFile = libraryName + '.min.js';
} else {
outputFile = libraryName + '.js';
}
const config = {
entry: __dirname + '/src/index.js',
devtool: 'source-map',
output: {
path: __dirname + '/build',
filename: outputFile,
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [
{
test: /(\.jsx|\.js)$/,
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/
},
{
test: /(\.jsx|\.js)$/,
loader: 'eslint-loader',
exclude: /node_modules/
}
]
},
resolve: {
modules: [path.resolve('./node_modules'), path.resolve('./src')],
extensions: ['.json', '.js']
},
plugins: plugins
};
module.exports = webpackConfig;
module.exports = config;
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