Skip to content

Commit 830a291

Browse files
author
fabianmoronzirfas
committed
initial local commit
1 parent 9ba644f commit 830a291

File tree

7 files changed

+127
-0
lines changed

7 files changed

+127
-0
lines changed

Array/.gitkeep

Whitespace-only changes.

Function/.gitkeep

Whitespace-only changes.

Object/assign.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* https://gist.github.com/WebReflection/10404826
3+
*/
4+
/* eslint no-use-before-define: off */
5+
6+
try {
7+
Object.assign({}, {foo: 'bar'});
8+
}catch(err) {
9+
// failed: so we're in IE8
10+
(function() {
11+
Object.assign = (function(has) {
12+
'use strict';
13+
return assign;
14+
function assign(target, source) {
15+
for (var i = 1; i < arguments.length; i++) {
16+
copy(target, arguments[i]);
17+
}
18+
return target;
19+
}
20+
function copy(target, source) {
21+
for (var key in source) {
22+
if (has.call(source, key)) {
23+
target[key] = source[key];
24+
}
25+
}
26+
}
27+
}({}.hasOwnProperty));
28+
}());
29+
}

String/.gitkeep

Whitespace-only changes.

bin/concat.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const folders = ['./Array/', './Function/', './Object/', './String/'];
2+
// const testFolder = './Array/';
3+
const fs = require('fs');
4+
const path = require('path');
5+
const cat = require('cat');
6+
const bundlePath = path.resolve(process.cwd(), './index.js');
7+
8+
// clear the file
9+
fs.writeFileSync(path.resolve(process.cwd(), bundlePath), '');
10+
// loop folders
11+
folders.forEach(folder => {
12+
fs.readdir(folder, (err, files) => {
13+
files.forEach(file => {
14+
// console.log(file);
15+
let filePath = path.resolve(process.cwd(), `${folder}${file}`);
16+
// console.log(filePath);
17+
cat(filePath, (error, data)=>{
18+
if(error !== null) {
19+
console.log(error);
20+
process.exit();
21+
}
22+
fs.appendFileSync(bundlePath, `//${file}\n${data}\n`);
23+
});
24+
});
25+
});
26+
27+
});

index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//.gitkeep
2+
3+
//.gitkeep
4+
5+
//.gitkeep
6+
7+
//assign.js
8+
/**
9+
* https://gist.github.com/WebReflection/10404826
10+
*/
11+
/* eslint no-use-before-define: off */
12+
13+
try {
14+
Object.assign({}, {foo: 'bar'});
15+
}catch(err) {
16+
// failed: so we're in IE8
17+
(function() {
18+
Object.assign = (function(has) {
19+
'use strict';
20+
return assign;
21+
function assign(target, source) {
22+
for (var i = 1; i < arguments.length; i++) {
23+
copy(target, arguments[i]);
24+
}
25+
return target;
26+
}
27+
function copy(target, source) {
28+
for (var key in source) {
29+
if (has.call(source, key)) {
30+
target[key] = source[key];
31+
}
32+
}
33+
}
34+
}({}.hasOwnProperty));
35+
}());
36+
}
37+

package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "extendscript-es6-shim",
3+
"version": "0.0.1",
4+
"description": "a collection of useful es6-shims for Extendscript",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"bundle":"node bin/concat.js"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/ExtendScript/extendscript-es6-shim.git"
13+
},
14+
"keywords": [
15+
"Extendscript",
16+
"ES6",
17+
"shim",
18+
"sham",
19+
"prototype"
20+
],
21+
"contributers": [
22+
"Fabian Morón Zirfas <[email protected]> (http://fabianmoronzirfas.me)",
23+
"EugenTepin",
24+
"andyinabox"
25+
],
26+
"license": "MIT",
27+
"bugs": {
28+
"url": "https://github.com/ExtendScript/extendscript-es6-shim/issues"
29+
},
30+
"homepage": "https://github.com/ExtendScript/extendscript-es6-shim#readme",
31+
"devDependencies": {
32+
"cat": "^0.2.0"
33+
}
34+
}

0 commit comments

Comments
 (0)