mirror of
https://github.com/twitter/twemoji.git
synced 2024-06-15 03:35:16 +00:00
avoid errors when required via node and no location is present
This commit is contained in:
parent
db01efff07
commit
a8ad0e4e07
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"name": "twemoji",
|
"name": "twemoji",
|
||||||
"license": ["MIT", "CC-BY-4.0"],
|
"license": ["MIT", "CC-BY-4.0"],
|
||||||
"description": "A Unicode standard based way to implement emoji across all platforms.",
|
"description": "A Unicode standard based way to implement emoji across all platforms.",
|
||||||
|
@ -8,7 +8,14 @@ var fs = require('fs');
|
|||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
'twemoji.npm.js',
|
'twemoji.npm.js',
|
||||||
fs.readFileSync('twemoji.js') + '\nmodule.exports = twemoji;'
|
[
|
||||||
|
'var location = global.location || {};',
|
||||||
|
fs.readFileSync('twemoji.js'),
|
||||||
|
'if (!location.protocol) {',
|
||||||
|
' twemoji.base = twemoji.base.replace(/^http:/, "");',
|
||||||
|
'}',
|
||||||
|
'module.exports = twemoji;'
|
||||||
|
].join('\n')
|
||||||
);
|
);
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
var location = global.location || {};
|
||||||
/*jslint indent: 2, browser: true, bitwise: true, plusplus: true */
|
/*jslint indent: 2, browser: true, bitwise: true, plusplus: true */
|
||||||
var twemoji = (function (
|
var twemoji = (function (
|
||||||
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//*
|
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//*
|
||||||
@ -510,4 +511,7 @@ var twemoji = (function (
|
|||||||
}
|
}
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
if (!location.protocol) {
|
||||||
|
twemoji.base = twemoji.base.replace(/^http:/, "");
|
||||||
|
}
|
||||||
module.exports = twemoji;
|
module.exports = twemoji;
|
Loading…
Reference in New Issue
Block a user